CsCrypto  2.0.0
sha2.h
1 /***********************************************************************
2 *
3 * Copyright (c) 2021-2025 Tim van Deurzen
4 * Copyright (c) 2021-2025 Barbara Geller
5 * Copyright (c) 2021-2025 Ansel Sermersheim
6 *
7 * This file is part of CsCrypto.
8 *
9 * CsCrypto is free software which is released under the BSD 2-Clause license.
10 * For license details refer to the LICENSE provided with this project.
11 *
12 * CsCrypto is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 *
16 * https://opensource.org/licenses/BSD-2-Clause
17 *
18 ***********************************************************************/
19 
20 #ifndef CS_CRYPTO_SHA2_H
21 #define CS_CRYPTO_SHA2_H
22 
23 #include <core/hash/hash_digest.h>
24 #include <core/hash/hash_traits.h>
25 
26 namespace cs_crypto::hash {
27 
28 template <typename Driver, typename... Ts>
29 auto sha2_224(Ts &&... args)
30 {
31  return hash_digest<Driver, traits::sha2_224_ctx>(std::forward<Ts>(args)...);
32 }
33 
34 template <typename Driver, typename... Ts>
35 auto sha2_256(Ts &&... args)
36 {
37  return hash_digest<Driver, traits::sha2_256_ctx>(std::forward<Ts>(args)...);
38 }
39 
40 template <typename Driver, typename... Ts>
41 auto sha2_384(Ts &&... args)
42 {
43  return hash_digest<Driver, traits::sha2_384_ctx>(std::forward<Ts>(args)...);
44 }
45 
46 template <typename Driver, typename... Ts>
47 auto sha2_512(Ts &&... args)
48 {
49  return hash_digest<Driver, traits::sha2_512_ctx>(std::forward<Ts>(args)...);
50 }
51 
52 } // namespace cs_crypto::hash
53 
54 #endif