Rtos API example
ns_sha256.h File Reference
SHA-256 cryptographic hash function. More...
Go to the source code of this file.
Data Structures | |
struct | ns_sha256_context |
SHA-256 context structure. More... | |
Functions | |
static void | ns_sha256_init (ns_sha256_context *ctx) |
Initialize SHA-256 context. | |
static void | ns_sha256_free (ns_sha256_context *ctx) |
Clear SHA-256 context. | |
static void | ns_sha256_clone (ns_sha256_context *dst, const ns_sha256_context *src) |
Clone (the state of) a SHA-256 context. | |
static void | ns_sha256_starts (ns_sha256_context *ctx) |
SHA-256 context setup. | |
static void | ns_sha256_update (ns_sha256_context *ctx, const void *input, size_t ilen) |
SHA-256 process buffer. | |
static void | ns_sha256_finish (ns_sha256_context *ctx, void *output) |
SHA-256 final digest. | |
static void | ns_sha256 (const void *input, size_t ilen, void *output) |
Output = SHA-256( input buffer ) | |
static void | ns_sha256_finish_nbits (ns_sha256_context *ctx, void *output, unsigned obits) |
SHA-256 final digest. | |
static void | ns_sha256_nbits (const void *input, size_t ilen, void *output, unsigned obits) |
Output = SHA-256( input buffer ) |
Detailed Description
SHA-256 cryptographic hash function.
This file is derived from sha256.h in mbed TLS 2.3.0.
This file provides an API very similar to mbed TLS, either implemented locally, or by calling mbed TLS, depending on NS_USE_EXTERNAL_MBED_TLS.
Differences from mbed TLS:
a) ns_ prefix instead of mbedtls_; b) Pointers are void * instead of unsigned char * to avoid type clashes; c) SHA-224 not supported; d) Ability to output truncated hashes.
Definition in file ns_sha256.h.
Function Documentation
void ns_sha256 | ( | const void * | input, |
size_t | ilen, | ||
void * | output | ||
) | [static] |
Output = SHA-256( input buffer )
- Parameters:
-
input buffer holding the data ilen length of the input data output SHA-256 checksum result
Definition at line 75 of file ns_sha256.h.
void ns_sha256_clone | ( | ns_sha256_context * | dst, |
const ns_sha256_context * | src | ||
) | [static] |
Clone (the state of) a SHA-256 context.
- Parameters:
-
dst The destination context src The context to be cloned
Definition at line 53 of file ns_sha256.h.
void ns_sha256_finish | ( | ns_sha256_context * | ctx, |
void * | output | ||
) | [static] |
SHA-256 final digest.
- Parameters:
-
ctx SHA-256 context output SHA-256 checksum result
Definition at line 70 of file ns_sha256.h.
void ns_sha256_finish_nbits | ( | ns_sha256_context * | ctx, |
void * | output, | ||
unsigned | obits | ||
) | [static] |
SHA-256 final digest.
- Parameters:
-
ctx SHA-256 context output SHA-256 checksum result obits Number of bits of to output - must be multiple of 32
Definition at line 82 of file ns_sha256.h.
void ns_sha256_free | ( | ns_sha256_context * | ctx ) | [static] |
Clear SHA-256 context.
- Parameters:
-
ctx SHA-256 context to be cleared
Definition at line 48 of file ns_sha256.h.
void ns_sha256_init | ( | ns_sha256_context * | ctx ) | [static] |
Initialize SHA-256 context.
- Parameters:
-
ctx SHA-256 context to be initialized
Definition at line 43 of file ns_sha256.h.
void ns_sha256_nbits | ( | const void * | input, |
size_t | ilen, | ||
void * | output, | ||
unsigned | obits | ||
) | [static] |
Output = SHA-256( input buffer )
- Parameters:
-
input buffer holding the data ilen length of the input data output SHA-256 checksum result obits Number of bits of to output - must be multiple of 32
Definition at line 93 of file ns_sha256.h.
void ns_sha256_starts | ( | ns_sha256_context * | ctx ) | [static] |
SHA-256 context setup.
- Parameters:
-
ctx context to be initialized
Definition at line 59 of file ns_sha256.h.
void ns_sha256_update | ( | ns_sha256_context * | ctx, |
const void * | input, | ||
size_t | ilen | ||
) | [static] |
SHA-256 process buffer.
- Parameters:
-
ctx SHA-256 context input buffer holding the data ilen length of the input data
Definition at line 64 of file ns_sha256.h.
Generated on Sun Jul 17 2022 08:25:35 by 1.7.2