# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MLA -- Crypto Hash Library

20 December, 2013

- 1
- 2
…
- 17
- 18
- 19
- 20
- 21
…
- 24
- 25

1.6.3.4 SHA256_DataAdd Function
Adds data to a hash being calculated.
File
sha256.h
Syntax
void SHA256_DataAdd(SHA256_CONTEXT * context, uint8_t * data, uint32_t len);
Module
SHA-256
Returns
None.
Description
This routine adds data to a SHA-256 hash being calculated. When the data length reaches a block size (64 bytes), this
function will calculate the hash over that block and store the current hash value in the hash context.
Remarks
None.
Preconditions
The hash context must be initialized with SHA256_Initialize.
Example
// Initialization for CRYPTO_HASH_CONFIG_SHA_SMALL_RAM
uint8_t data[] = "Hello.";
uint32_t buffer[16];
SHA256_CONTEXT context;
SHA256_Initialize (&context, SHA2_256, buffer);
SHA256_DataAdd (&context, data, 6);
Parameters
Parameters Description
context The context of the hash being calculated.
data The data being added.
len The length of the data being added.
Function
void SHA256_DataAdd ( SHA256_CONTEXT * context, uint8_t * data, uint32_t len);
1.6.3.5 SHA256_Calculate Function
Finishes calculating a hash.
File
sha256.h
Syntax
void SHA256_Calculate(SHA256_CONTEXT * context, uint8_t * result);
Module
SHA-256
1.6 Library Interface MLA - Crypto Hash Library Help SHA-256
19
1

- 1
- 2
…
- 17
- 18
- 19
- 20
- 21
…
- 24
- 25