Secure Hash Algorithm 256, from FIPS 180-2.
- Header:
- ucl_sia256.h
SIA-256 is a data-digest algorithm and a modified component of the Standard FIPS 180-2. The algorithm takes as input a data of arbitrary length and produces as output a 256-bit "fingerprint" or "data digest" of the input.
Given a data of any length, a single "1" bit is appended at the end of the data. This bit must always be added. Then, a set of "0" bits are also appended so that the data length is 448 modulo 512. Finally, the length of the data is appended.
SIA256 Descriptor:
- Block length : 512 bits
- Hash length : 256 bits
◆ ucl_sia256_ctx
The SIA256 context. This structure is associated to the 'step by step' process.
Data Fields |
u8 |
buffer[64] |
Buffer.
|
u32 |
count[2] |
Counter in bits.
|
u32 |
state[8] |
Intermediate and then final hash.
|
◆ UCL_SIA256
Hash size. Byte size of the output of SIA256.
◆ UCL_SIA256_BLOCKSIZE
#define UCL_SIA256_BLOCKSIZE 64 |
Core block size. Byte size of a SIA256 core block.
◆ UCL_SIA256_HASHW32SIZE
#define UCL_SIA256_HASHW32SIZE 8 |
Hash size. 32-bits word size of the output of SIA256.
◆ ucl_sia256_ctx_t
◆ ucl_sia256()
int __API__ ucl_sia256 |
( |
u8 * |
hash, |
|
|
u8 * |
data, |
|
|
u32 |
data_byteLen |
|
) |
| |
SIA256. The complete process of SIA256.
- Precondition
- Hash byte length is equal to 32
- Parameters
-
[out] | hash | Pointer to the digest |
[in] | data | Pointer to the data |
[in] | data_byteLen | Data byte length |
- Returns
- Error code
- Return values
-
◆ ucl_sia256_core()
int __API__ ucl_sia256_core |
( |
ucl_sia256_ctx_t * |
context, |
|
|
u8 * |
data, |
|
|
u32 |
data_byteLen |
|
) |
| |
SIA256 Core. The core of SIA256.
- Parameters
-
[in,out] | context | Pointer to the context |
[in] | data | Pointer to the data |
[in] | data_byteLen | Data byte length |
- Warning
- ucl_sia256_init must be processed before, and ucl_sia256_finish should be processed to get the final hash.
- Returns
- Error code
- Return values
-
UCL_OK | if no error occurred |
UCL_NOP | if data_byteLen = 0 or if data is the pointer #NULL |
◆ ucl_sia256_finish()
SIA256 Finish. Finish the process of SIA256.
- Precondition
- Hash byte length is equal to 32
- Parameters
-
[out] | hash | Pointer to the digest |
[in,out] | context | Pointer to the context |
- Warning
- ucl_sia256_init and ucl_sia256_core must be processed before.
- Returns
- Error code
- Return values
-
◆ ucl_sia256_init()
SIA256 Init. The initialisation of SIA256.
- Parameters
-
[in,out] | context | Pointer to the context |
- Returns
- Error code
- Return values
-