1//
2// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3//
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// Official repository: https://github.com/boostorg/beast
8//
9
10#ifndef BOOST_BEAST_DETAIL_SHA1_HPP
11#define BOOST_BEAST_DETAIL_SHA1_HPP
12
13#include <boost/beast/core/detail/config.hpp>
14#include <cstdint>
15#include <cstddef>
16
17// Based on https://github.com/vog/sha1
18/*
19 Original authors:
20 Steve Reid (Original C Code)
21 Bruce Guenter (Small changes to fit into bglibs)
22 Volker Grabsch (Translation to simpler C++ Code)
23 Eugene Hopkinson (Safety improvements)
24 Vincent Falco (beast adaptation)
25*/
26
27namespace boost {
28namespace beast {
29namespace detail {
30
31namespace sha1 {
32
33static std::size_t constexpr BLOCK_INTS = 16;
34static std::size_t constexpr BLOCK_BYTES = 64;
35static std::size_t constexpr DIGEST_BYTES = 20;
36
37} // sha1
38
39struct sha1_context
40{
41 static unsigned int constexpr block_size = sha1::BLOCK_BYTES;
42 static unsigned int constexpr digest_size = 20;
43
44 std::size_t buflen;
45 std::size_t blocks;
46 std::uint32_t digest[5];
47 std::uint8_t buf[block_size];
48};
49
50BOOST_BEAST_DECL
51void
52init(sha1_context& ctx) noexcept;
53
54BOOST_BEAST_DECL
55void
56update(
57 sha1_context& ctx,
58 void const* message,
59 std::size_t size) noexcept;
60
61BOOST_BEAST_DECL
62void
63finish(
64 sha1_context& ctx,
65 void* digest) noexcept;
66
67} // detail
68} // beast
69} // boost
70
71#ifdef BOOST_BEAST_HEADER_ONLY
72#include <boost/beast/core/detail/sha1.ipp>
73#endif
74
75#endif
76

source code of boost/libs/beast/include/boost/beast/core/detail/sha1.hpp