[Python] Is this Python code performing SHA512 or a variant of SHA512?

Discussão em 'Python' iniciado por Stack, Setembro 4, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to convert this Python to C++:

    import base64
    from cryptography.hazmat.primitives.serialization import load_pem_private_key


    with open(PRIVATE_KEY_PATH, 'rb') as f:
    private_key = load_pem_private_key(data=f.read(),
    password=None)

    data = "test"

    signature = base64.b64encode(private_key.sign(data.encode('ASCII')))


    I think it's performing SHA512?

    However, when I look for C/C++ implementations performing SHA512 they seem to all accept only one argument, whereas this has two: data and key.

    What is this doing exactly? Is it something like a HMAC-SHA512?

    Continue reading...

Compartilhe esta Página