Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:24

0001 //
0002 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/beast
0008 //
0009 
0010 #ifndef BOOST_BEAST_DETAIL_SHA1_HPP
0011 #define BOOST_BEAST_DETAIL_SHA1_HPP
0012 
0013 #include <boost/beast/core/detail/config.hpp>
0014 #include <cstdint>
0015 #include <cstddef>
0016 
0017 // Based on https://github.com/vog/sha1
0018 /*
0019     Original authors:
0020         Steve Reid (Original C Code)
0021         Bruce Guenter (Small changes to fit into bglibs)
0022         Volker Grabsch (Translation to simpler C++ Code)
0023         Eugene Hopkinson (Safety improvements)
0024         Vincent Falco (beast adaptation)
0025 */
0026 
0027 namespace boost {
0028 namespace beast {
0029 namespace detail {
0030 
0031 namespace sha1 {
0032 
0033 static std::size_t constexpr BLOCK_INTS = 16;
0034 static std::size_t constexpr BLOCK_BYTES = 64;
0035 static std::size_t constexpr DIGEST_BYTES = 20;
0036 
0037 } // sha1
0038 
0039 struct sha1_context
0040 {
0041     static unsigned int constexpr block_size = sha1::BLOCK_BYTES;
0042     static unsigned int constexpr digest_size = 20;
0043 
0044     std::size_t buflen;
0045     std::size_t blocks;
0046     std::uint32_t digest[5];
0047     std::uint8_t buf[block_size];
0048 };
0049 
0050 BOOST_BEAST_DECL
0051 void
0052 init(sha1_context& ctx) noexcept;
0053 
0054 BOOST_BEAST_DECL
0055 void
0056 update(
0057     sha1_context& ctx,
0058     void const* message,
0059     std::size_t size) noexcept;
0060 
0061 BOOST_BEAST_DECL
0062 void
0063 finish(
0064     sha1_context& ctx,
0065     void* digest) noexcept;
0066 
0067 } // detail
0068 } // beast
0069 } // boost
0070 
0071 #ifdef BOOST_BEAST_HEADER_ONLY
0072 #include <boost/beast/core/detail/sha1.ipp>
0073 #endif
0074 
0075 #endif