INNER CODE UNIT · Python
sign
open-quantum-safe/liboqs-python · oqs/oqs.py:723
def sign(self, message: bytes) -> bytes:
"""
Signs the provided message and returns the signature.
For external-mu variants (is_extmu, e.g. ML-DSA-*-extmu), message is the
externally computed mu rather than a raw message; liboqs enforces its
length (64 bytes for ML-DSA).
:param message: the message to sign (the externally computed mu for
external-mu variants).
"""
# Provide length to avoid extra null char
c_message = ct.create_string_buffer(message, len(message))
c_message_len = ct.c_size_t(len(c_message))
c_signature = ct.create_string_buffer(self._sig.contents.length_signature)
# Initialize to maximum signature size
c_signature_len = ct.c_size_t(self._sig.contents.length_signature)