# 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
…
- 18
- 19
- 20
- 21
- 22
…
- 24
- 25

Returns
None.
Description
This routine finishes calculating a SHA-256 hash. It will automatically add the padding required by the hashing algorithm and
return the hash digest.
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;
uint8_t digest[32];
SHA256_Initialize (&context, SHA2_256, buffer);
SHA256_DataAdd (&context, data, 6);
SHA256_Calculate (&context, digest);
Parameters
Parameters Description
context The context of the hash being calculated.
result A buffer to store the calculated hash digest. 32 bytes for
SHA-256, 28 bytes for SHA-224.
Function
void SHA256_Calculate ( SHA256_CONTEXT * context, uint8_t * result);
1.6.4 SHA-512
This section describes the types and functions used for the SHA-512 crypto hash module.
Enumerations
Name Description
SHA512_BIT_LENGTH
Functions
Name Description
SHA512_Initialize Initializes a SHA-256 context to perform a SHA-512 hash.
SHA512_DataAdd Adds data to a hash being calculated.
SHA512_Calculate Finishes calculating a hash.
Structures
Name Description
SHA512_CONTEXT Context storage for hash operation
Description
1.6 Library Interface MLA - Crypto Hash Library Help SHA-512
20
1

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