Botan 3.14.1
Crypto and TLS for C&
hash_engine_sha2_32.h
Go to the documentation of this file.
1/*
2* (C) 2026 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_HASH_ENGINE_SHA2_32_H_
8#define BOTAN_HASH_ENGINE_SHA2_32_H_
9
10#include <botan/internal/hash_engine.h>
11
12namespace Botan {
13
14/**
15* Create a multi-buffer SHA-256 Hash_Engine
16*
17* Returns nullptr if the hash is not SHA-256 (possibly truncated), if
18* the requested provider does not match, or if no SIMD implementation
19* is usable on this CPU.
20*/
21std::unique_ptr<Hash_Engine> create_sha2_32_mb_engine(std::string_view hash_fn,
22 std::span<const uint8_t> common_prefix,
23 std::string_view provider);
24
25/*
26* Multi-buffer SHA-256 compression functions
27*
28* The states buffer holds the 8 chaining variables for each lane, as
29* little-endian words in variable-major order (all lanes of A, then all
30* lanes of B, ...). blocks[l] points to the first of nblocks contiguous
31* 64 byte blocks for lane l.
32*
33* The extract functions transpose the states into the 32 byte big-endian
34* digest of each lane, stored contiguously in lane order.
35*/
36
37#if defined(BOTAN_HAS_HASH_ENGINE_SHA2_32_AVX2)
38void sha2_32_mb_compress_x8(uint8_t* states, const uint8_t* const* blocks, size_t nblocks);
39void sha2_32_mb_extract_x8(const uint8_t* states, uint8_t* digests);
40#endif
41
42#if defined(BOTAN_HAS_HASH_ENGINE_SHA2_32_AVX512)
43void sha2_32_mb_compress_x16(uint8_t* states, const uint8_t* const* blocks, size_t nblocks);
44void sha2_32_mb_extract_x16(const uint8_t* states, uint8_t* digests);
45#endif
46
47} // namespace Botan
48
49#endif
std::unique_ptr< Hash_Engine > create_sha2_32_mb_engine(std::string_view hash_fn, std::span< const uint8_t > common_prefix, std::string_view provider)
BOTAN_FN_ISA_AVX512 void sha2_32_mb_extract_x16(const uint8_t *states, uint8_t *digests)
BOTAN_FN_ISA_AVX512 void sha2_32_mb_compress_x16(uint8_t *states, const uint8_t *const *blocks, size_t nblocks)
BOTAN_FN_ISA_AVX2 void sha2_32_mb_extract_x8(const uint8_t *states, uint8_t *digests)
BOTAN_FN_ISA_AVX2 void sha2_32_mb_compress_x8(uint8_t *states, const uint8_t *const *blocks, size_t nblocks)