lcx_sha256.h | Developers

lcx_sha256.h

Back to the files list

SHA-2 (Secure Hash Algorithm 2) More...

Data Structures

struct  cx_sha256_s
 SHA-224 and SHA-256 context. More...

Macros

#define CX_SHA224_SIZE   28
 SHA-224 message digest size. More...
#define CX_SHA256_SIZE   32
 SHA-256 message digest size. More...

Typedefs

typedef struct cx_sha256_s cx_sha256_t
 Convenience type. More...

Functions

cx_err_t cx_sha224_init_no_throw (cx_sha256_t *hash)
 Initializes a SHA-224 context. More...
static int cx_sha224_init (cx_sha256_t *hash)
 Initializes a SHA-224 context. More...
cx_err_t cx_sha256_init_no_throw (cx_sha256_t *hash)
 Initializes a SHA-256 context. More...
static int cx_sha256_init (cx_sha256_t *hash)
 Initializes a SHA-256 context. More...
size_t cx_hash_sha256 (const uint8_t *in, size_t len, uint8_t *out, size_t out_len)
 Computes a one shot SHA-256 digest. More...

Detailed Description

SHA-2 (Secure Hash Algorithm 2)

SHA-224 and SHA-256 are secure hash functions belonging to the SHA-2 family with a digest length of 224 and 256 bits, respectively. The message length should be less than 264 bits. Refer to FIPS 180-4 for more details.

Macro Definition Documentation

CX_SHA224_SIZE

#define CX_SHA224_SIZE   28

SHA-224 message digest size.

CX_SHA256_SIZE

#define CX_SHA256_SIZE   32

SHA-256 message digest size.

Typedef Documentation

cx_sha256_t

typedef struct cx_sha256_s cx_sha256_t

Convenience type.

See cx_sha256_s.

Function Documentation

cx_hash_sha256()

size_t cx_hash_sha256 ( const uint8_t *  in,
size_t  len,
uint8_t *  out,
size_t  out_len 
)

Computes a one shot SHA-256 digest.

Parameters
[in]inInput data.
[in]lenLength of the input data.
[out]outBuffer where to store the digest.
[in]out_lenLength of the output. This is actually 256 bits.

cx_sha224_init()

static int cx_sha224_init ( cx_sha256_t hash)

Initializes a SHA-224 context.

Parameters
[out]hashPointer to the context. The context shall be in RAM.
Returns
SHA224 identifier.

cx_sha224_init_no_throw()

cx_err_t cx_sha224_init_no_throw ( cx_sha256_t hash)

Initializes a SHA-224 context.

Parameters
[out]hashPointer to the context. The context shall be in RAM.
Returns
Error code:
  • CX_OK on success

cx_sha256_init()

static int cx_sha256_init ( cx_sha256_t hash)

Initializes a SHA-256 context.

Parameters
[out]hashPointer to the context. The context shall be in RAM.
Returns
SHA256 identifier.

cx_sha256_init_no_throw()

cx_err_t cx_sha256_init_no_throw ( cx_sha256_t hash)

Initializes a SHA-256 context.

Parameters
[out]hashPointer to the context. The context shall be in RAM.
Returns
Error code:
  • CX_OK on success

Back to the files list


Did you find this page helpful?


How would you improve this page for developers?



Getting Started
Theme Features
Customization

Embedded Apps