# 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
…
- 14
- 15
- 16
- 17
- 18
…
- 24
- 25

1.6.2.4 SHA1_Calculate Function
Finishes calculating a hash.
File
sha1.h
Syntax
void SHA1_Calculate(SHA1_CONTEXT* context, uint8_t * result);
Module
SHA-1
Returns
None.
Description
This routine finishes calculating a SHA-1 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 SHA1_Initialize.
Example
// Initialization for CRYPTO_HASH_CONFIG_SHA_SMALL_RAM
uint8_t data[] = "Hello.";
uint32_t buffer[16];
SHA1_CONTEXT context;
uint8_t digest[20];
SHA1_Initialize (&context, buffer);
SHA1_DataAdd (&context, data, 6);
SHA1_Calculate (&context, digest);
Parameters
Parameters Description
context The context of the hash being calculated.
result A 20-byte buffer to store the calculated hash digest.
Function
void SHA1_Calculate( SHA1_CONTEXT* context, uint8_t * result);
1.6.3 SHA-256
This section describes the types and functions used for the SHA-256 crypto hash module.
Enumerations
Name Description
SHA256_BIT_LENGTH Enumeration for selecting output bit length
1.6 Library Interface MLA - Crypto Hash Library Help SHA-256
16
1

- 1
- 2
…
- 14
- 15
- 16
- 17
- 18
…
- 24
- 25