lcx_sha3.h Previous Back to the files list SHA-3 (Secure Hash Algorithm 3) More... Data Structures struct cx_sha3_s KECCAK, SHA3 and SHA3-XOF context. More... Typedefs typedef struct cx_sha3_s cx_sha3_t Convenience type. More... Functions cx_err_t cx_sha3_init_no_throw (cx_sha3_t *hash, size_t size) Initializes a SHA3 context. More... static int cx_sha3_init (cx_sha3_t *hash, size_t size) Initializes a SHA3 context. More... cx_err_t cx_keccak_init_no_throw (cx_sha3_t *hash, size_t size) Initializes a KECCAK context. More... static int cx_keccak_init (cx_sha3_t *hash, size_t size) Initializes a KECCAK context. More... cx_err_t cx_shake128_init_no_throw (cx_sha3_t *hash, size_t out_size) Initializes a SHA3-XOF context. More... static int cx_shake128_init (cx_sha3_t *hash, unsigned int out_size) Initializes a SHA3-XOF context. More... cx_err_t cx_shake256_init_no_throw (cx_sha3_t *hash, size_t out_size) Initializes a SHA3-XOF context. More... static int cx_shake256_init (cx_sha3_t *hash, unsigned int out_size) Initializes a SHA3-XOF context. More... cx_err_t cx_sha3_xof_init_no_throw (cx_sha3_t *hash, size_t size, size_t out_length) Initializes a SHA3-XOF context. More... static int cx_sha3_xof_init (cx_sha3_t *hash, unsigned int size, unsigned int out_length) Initializes a SHA3-XOF context. More... Detailed Description SHA-3 (Secure Hash Algorithm 3) SHA-3 specifies a family of secure hash functions based on an instance of the KECCAK algorithm. Refer to FIPS 202 for more details. Typedef Documentation cx_sha3_t typedef struct cx_sha3_s cx_sha3_t Convenience type. See cx_sha3_s. Function Documentation cx_keccak_init() static int cx_keccak_init ( cx_sha3_t * hash, size_t size ) Initializes a KECCAK context. Supported output sizes in bits: 224 256 384 512 This function throws an exception if the initialization fails. WarningIt is recommended to use cx_keccak_init_no_throw rather than this function. Parameters [out]hashPointer to the KECCAK context. The context shall be in RAM. [in]sizeLength of the hash output in bits. ReturnsKECCAK identifier. Exceptions CX_INVALID_PARAMETER cx_keccak_init_no_throw() cx_err_t cx_keccak_init_no_throw ( cx_sha3_t * hash, size_t size ) Initializes a KECCAK context. Supported output sizes in bits: 224 256 384 512 Parameters [out]hashPointer to the KECCAK context. The context shall be in RAM. [in]sizeLength of the hash output in bits. ReturnsError code: CX_OK on success CX_INVALID_PARAMETER cx_sha3_init() static int cx_sha3_init ( cx_sha3_t * hash, size_t size ) Initializes a SHA3 context. Supported output sizes in bits: 224 256 384 512 This function throws an exception if the initialization fails. WarningIt is recommended to use cx_sha3_init_no_throw rather than this function. Parameters [out]hashPointer to the SHA3 context. The context shall be in RAM. [in]sizeLength of the hash output in bits. ReturnsSHA3 identifier. Exceptions CX_INVALID_PARAMETER cx_sha3_init_no_throw() cx_err_t cx_sha3_init_no_throw ( cx_sha3_t * hash, size_t size ) Initializes a SHA3 context. Supported output sizes in bits: 224 256 384 512 Parameters [out]hashPointer to the SHA3 context. The context shall be in RAM. [in]sizeLength of the hash output in bits. ReturnsError code: CX_OK on success CX_INVALID_PARAMETER cx_sha3_xof_init() static int cx_sha3_xof_init ( cx_sha3_t * hash, unsigned int size, unsigned int out_length ) Initializes a SHA3-XOF context. This can be used to initialize either SHAKE128 or SHAKE256. Supported output sizes in bits: 256 512 This function throws an exception if the computation doesn't succeed. WarningIt is recommended to use cx_sha3_xof_init_no_throw rather than this function. Parameters [out]hashPointer to the context. The context shall be in RAM. [in]sizeLength of SHA3 digest in bits. [in]out_lengthLength of the output in bytes. ReturnsEither SHAKE128 or SHAKE256 identifier. Exceptions CX_INVALID_PARAMETER cx_sha3_xof_init_no_throw() cx_err_t cx_sha3_xof_init_no_throw ( cx_sha3_t * hash, size_t size, size_t out_length ) Initializes a SHA3-XOF context. This can be used to initialize either SHAKE128 or SHAKE256. Supported output sizes in bits: 256 512 Parameters [out]hashPointer to the context. The context shall be in RAM. [in]sizeLength of SHA3 digest in bits. [in]out_lengthLength of the output in bytes. ReturnsError code: CX_OK on success CX_INVALID_PARAMETER cx_shake128_init() static int cx_shake128_init ( cx_sha3_t * hash, unsigned int out_size ) Initializes a SHA3-XOF context. SHAKE128 is a SHA3-XOF (Extendable Output Function based on SHA3) with a 128-bit security. Supported output sizes in bits: 256 512 This function throws an exception if the initialization doesn't succeed. WarningIt is recommended to use cx_shake128_init_no_throw rather than this function. Parameters [out]hashPointer to the context. The context shall be in RAM. [in]out_sizeLength of the output in bits. ReturnsSHAKE128 identifier. Exceptions CX_INVALID_PARAMETER cx_shake128_init_no_throw() cx_err_t cx_shake128_init_no_throw ( cx_sha3_t * hash, size_t out_size ) Initializes a SHA3-XOF context. SHAKE128 is a SHA3-XOF (Extendable Output Function based on SHA3) with a 128-bit security. Supported output sizes in bits: 256 512 Parameters [out]hashPointer to the context. The context shall be in RAM. [in]out_sizeLength of the output in bits. ReturnsError code: CX_OK on success CX_INVALID_PARAMETER cx_shake256_init() static int cx_shake256_init ( cx_sha3_t * hash, unsigned int out_size ) Initializes a SHA3-XOF context. SHAKE256 is a SHA3-XOF (Extendable Output Function based on SHA3) with a 256-bit security. Supported output sizes in bits: 256 512 This function throws an exception if the initialization doesn't succeed. WarningIt is recommended to use cx_shake256_init_no_throw rather than this function. Parameters [out]hashPointer to the context. The context shall be in RAM. [in]out_sizeLength of the output in bits. ReturnsSHA256 identifier. Exceptions CX_INVALID_PARAMETER cx_shake256_init_no_throw() cx_err_t cx_shake256_init_no_throw ( cx_sha3_t * hash, size_t out_size ) Initializes a SHA3-XOF context. SHAKE256 is a SHA3-XOF (Extendable Output Function based on SHA3) with a 256-bit security. Supported output sizes in bits: 256 512 Parameters [out]hashPointer to the context. The context shall be in RAM. [in]out_sizeLength of the output in bits. ReturnsError code: CX_OK on success CX_INVALID_PARAMETER Previous Back to the files list Did you find this page helpful? How would you improve this page for developers? I am a developer. Contributors will be chosen randomly to receive rewards. Check this box to send your email and participate. Ledger collects your email address to send you rewards for your contribution to improve the Developer Portal documentation. Learn more about how we manage your data and your rights. By providing your email address, you consent that Ledger may contact you for rewards delivery purposes. If you are part of the randomly selected contributors, we will send you an email to ask for your physical address and if necessary, ask you for additional information on the suggestion you made. Your information will only be available to Ledger and will be retained for no longer than 90 days. It may be transferred to non-European countries that ensure an adequate level of protection or under the standard contractual clauses adopted by the EU Commission. Please note that you may withdraw your consent at any time, access your data and request their rectification or deletion. You may also request the limitation of the processing of your data. To exercise your rights or for any question on the processing of your data, please contact LEDGER’s Data Protection Officer here. If nevertheless you believe LEDGER did not adequately address your concerns and mishandled your data, you may lodge a complaint with the personal data protection authority of your country.