fix some locking issues, change string storage to first four letters of the hexadecimal sha512 of the string, use sha512 instead of md5 in hashing as it has no significant speed impact