MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
SHA Algorithm API.
SHA Functional Operation | |
status_t | SHA_Init (SHA_Type *base, sha_ctx_t *ctx, sha_algo_t algo) |
Initialize HASH context. More... | |
status_t | SHA_Update (SHA_Type *base, sha_ctx_t *ctx, const uint8_t *message, size_t messageSize) |
Add data to current HASH. More... | |
status_t | SHA_Finish (SHA_Type *base, sha_ctx_t *ctx, uint8_t *output, size_t *outputSize) |
Finalize hashing. More... | |
status_t SHA_Init | ( | SHA_Type * | base, |
sha_ctx_t * | ctx, | ||
sha_algo_t | algo | ||
) |
This function initializes new hash context.
base | SHA peripheral base address | |
[out] | ctx | Output hash context |
algo | Underlaying algorithm to use for hash computation. Either SHA-1 or SHA-256. |
status_t SHA_Update | ( | SHA_Type * | base, |
sha_ctx_t * | ctx, | ||
const uint8_t * | message, | ||
size_t | messageSize | ||
) |
Add data to current HASH. This can be called repeatedly with an arbitrary amount of data to be hashed.
base | SHA peripheral base address | |
[in,out] | ctx | HASH context |
message | Input message | |
messageSize | Size of input message in bytes |
Outputs the final hash and erases the context. SHA-1 or SHA-256 padding bits are automatically added by this function.
base | SHA peripheral base address | |
[in,out] | ctx | HASH context |
[out] | output | Output hash data |
[in,out] | outputSize | On input, determines the size of bytes of the output array. On output, tells how many bytes have been written to output. |