crypto_hash_3.py 425 B

12345678910111213
  1. def crypto_hash_sha512(message):
  2. """
  3. Hashes and returns the message ``message``.
  4. :param message: bytes
  5. :rtype: bytes
  6. """
  7. digest = ffi.new("unsigned char[]", crypto_hash_sha512_BYTES)
  8. rc = lib.crypto_hash_sha512(digest, message, len(message))
  9. ensure(rc == 0,
  10. 'Unexpected library error',
  11. raising=exc.RuntimeError)
  12. return ffi.buffer(digest, crypto_hash_sha512_BYTES)[:]