Botan 3.4.0
Crypto and TLS for C&
xmd.h
Go to the documentation of this file.
1/*
2* (C) 2024 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_KDF_XMD_H_
8#define BOTAN_KDF_XMD_H_
9
10#include <botan/types.h>
11#include <span>
12#include <string_view>
13
14namespace Botan {
15
16/**
17* XMD hash function from RFC 9380
18*
19* This is only used internally to implement hash2curve so is not
20* exposed to end users.
21*/
22void BOTAN_TEST_API expand_message_xmd(std::string_view hash_fn,
23 std::span<uint8_t> output,
24 std::span<const uint8_t> input,
25 std::span<const uint8_t> domain_sep);
26
27inline void expand_message_xmd(std::string_view hash_fn,
28 std::span<uint8_t> output,
29 std::string_view input_str,
30 std::string_view domain_sep_str) {
31 std::span<const uint8_t> input(reinterpret_cast<const uint8_t*>(input_str.data()), input_str.size());
32
33 std::span<const uint8_t> domain_sep(reinterpret_cast<const uint8_t*>(domain_sep_str.data()), domain_sep_str.size());
34
35 expand_message_xmd(hash_fn, output, input, domain_sep);
36}
37
38} // namespace Botan
39
40#endif
#define BOTAN_TEST_API
Definition compiler.h:51
void expand_message_xmd(std::string_view hash_fn, std::span< uint8_t > output, std::span< const uint8_t > input, std::span< const uint8_t > domain_sep)
Definition xmd.cpp:16