Verified Commit 94d60a05 authored by Pavol Žáčik's avatar Pavol Žáčik
Browse files

Rename hash to sha256_hash

parent 645b8edc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ from pv080_crypto.symmetric import (
    chacha20_decrypt,
    aes_encrypt,
    aes_decrypt,
    hash,
    sha256_hash,
    create_mac,
    verify_mac,
)
@@ -82,6 +82,7 @@ __all__ = [
    "chacha20_decrypt",
    "aes_encrypt",
    "aes_decrypt",
    "sha256_hash",
    "create_mac",
    "verify_mac",
    # asymmetric
+4 −4
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@ There are also lower level primitives such as :py:func:`XOR
<pv080_crypto.symmetric.XOR>`, :py:func:`pad <pv080_crypto.symmetric.pad>` and
:py:func:`unpad <pv080_crypto.symmetric.unpad>`.

Finally, there is a hash function :py:func:`hash
<pv080_crypto.symmetric.hash>`, and functions :py:func:`create_mac
Finally, there is a hash function :py:func:`sha256_hash
<pv080_crypto.symmetric.sha256_hash>`, and functions :py:func:`create_mac
<pv080_crypto.symmetric.create_mac>` and :py:func:`verify_mac
<pv080_crypto.symmetric.verify_mac>` for creating and verifying `Message
Authentication Codes
@@ -306,7 +306,7 @@ def aes_decrypt(key: bytes, ciphertext: bytes) -> bytes:
    return plaintext


def hash(data: bytes) -> bytes:
def sha256_hash(data: bytes) -> bytes:
    """
    Compute the SHA256 hash of the given `data`.

@@ -317,7 +317,7 @@ def hash(data: bytes) -> bytes:
    Example:

    >>> message = b"Hello world"
    >>> digest = hash(message)
    >>> digest = sha256_hash(message)
    >>> print(digest.hex(sep=' '))
    '64 ec 88 ca 00 b2 68 e5 ba 1a 35 67 8a 1b 53 16 d2 12 f4 f3 66 b2 47 72 32 53 4a 8a ec a3 7f 3c'
    """