Beispiel #1
0
def crypto_hash_sha512(message):
    """
    Hashes and returns the message ``message``.

    :param message: bytes
    :rtype: bytes
    """
    digest = lib.ffi.new("unsigned char[]", crypto_hash_sha512_BYTES)
    rc = lib.crypto_hash_sha512(digest, message, len(message))
    assert rc == 0
    return lib.ffi.buffer(digest, crypto_hash_sha512_BYTES)[:]
Beispiel #2
0
def crypto_hash_sha512(message):
    """
    Hashes and returns the message ``message``.

    :param message: bytes
    :rtype: bytes
    """
    digest = lib.ffi.new("unsigned char[]", crypto_hash_sha512_BYTES)
    if lib.crypto_hash_sha512(digest, message, len(message)) != 0:
        raise CryptoError("Hashing failed")
    return lib.ffi.buffer(digest, crypto_hash_sha512_BYTES)[:]
def crypto_hash_sha512(message):
    """
    Hashes and returns the message ``message``.

    :param message: bytes
    :rtype: bytes
    """
    digest = lib.ffi.new("unsigned char[]", crypto_hash_sha512_BYTES)
    if lib.crypto_hash_sha512(digest, message, len(message)) != 0:
        raise CryptoError("Hashing failed")
    return lib.ffi.buffer(digest, crypto_hash_sha512_BYTES)[:]