safe enough 8-character short unique random string

Which method has less collisions, is faster and easier to read? TLDR The random_choice is the fastest, has fewer collisions but is IMO slightly harder to read. The most readable is shortuuid_random but is an external dependency and is slightly slower and has 6x the collisions. The methods alphabet = string.ascii_lowercase + string.digits su = … Read more

MD5 hash from file in C++

Here’s a straight forward implementation of the md5sum command that computes and displays the MD5 of the file specified on the command-line. It needs to be linked against the OpenSSL library (gcc md5.c -o md5 -lssl) to work. It’s pure C, but you should be able to adapt it to your C++ application easily enough. … Read more

fast, large-width, non-cryptographic string hashing in python

Take a look at the 128-bit variant of MurmurHash3. The algorithm’s page includes some performance numbers. Should be possible to port this to Python, pure or as a C extension. (Updated the author recommends using the 128-bit variant and throwing away the bits you don’t need). If MurmurHash2 64-bit works for you, there is a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)