]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/beast/core/detail/sha1.hpp
bump version to 19.2.0-pve1
[ceph.git] / ceph / src / boost / boost / beast / core / detail / sha1.hpp
CommitLineData
7c673cae 1//
92f5a8d4 2// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
7c673cae
FG
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//
b32b8144
FG
7// Official repository: https://github.com/boostorg/beast
8//
7c673cae 9
b32b8144
FG
10#ifndef BOOST_BEAST_DETAIL_SHA1_HPP
11#define BOOST_BEAST_DETAIL_SHA1_HPP
7c673cae 12
92f5a8d4 13#include <boost/beast/core/detail/config.hpp>
7c673cae 14#include <cstdint>
f67539c2 15#include <cstddef>
7c673cae
FG
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
b32b8144 27namespace boost {
7c673cae
FG
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
7c673cae
FG
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
92f5a8d4 50BOOST_BEAST_DECL
7c673cae 51void
92f5a8d4 52init(sha1_context& ctx) noexcept;
7c673cae 53
92f5a8d4 54BOOST_BEAST_DECL
7c673cae 55void
92f5a8d4
TL
56update(
57 sha1_context& ctx,
58 void const* message,
59 std::size_t size) noexcept;
7c673cae 60
92f5a8d4 61BOOST_BEAST_DECL
7c673cae 62void
92f5a8d4
TL
63finish(
64 sha1_context& ctx,
65 void* digest) noexcept;
7c673cae
FG
66
67} // detail
68} // beast
b32b8144 69} // boost
7c673cae 70
92f5a8d4
TL
71#ifdef BOOST_BEAST_HEADER_ONLY
72#include <boost/beast/core/detail/sha1.ipp>
73#endif
74
7c673cae 75#endif