I’m not what is going wrong exactly but sha512 is 64 bytes (512 / 8) and base 64 encoded it is 86 or 88 bytes depending on padding. If the Drupal in code comment examples or your hashes are a different length then I think probably you’re not using the raw bytes from the hash, but instead using the hash that has already gone through some sort of encoding. Also, I think bcrypt only uses the first 55 bytes, is it possible you are loading the hash using bcrypt…?