LCOV - code coverage report
Current view: top level - src/crypto - sha3.h (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 1 1 100.0 %
Date: 2022-04-21 14:51:19 Functions: 1 1 100.0 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
Branches: 0 0 -

           Branch data     Line data    Source code
#       1                 :            : // Copyright (c) 2020 The Bitcoin Core developers
#       2                 :            : // Distributed under the MIT software license, see the accompanying
#       3                 :            : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#       4                 :            : 
#       5                 :            : #ifndef BITCOIN_CRYPTO_SHA3_H
#       6                 :            : #define BITCOIN_CRYPTO_SHA3_H
#       7                 :            : 
#       8                 :            : #include <span.h>
#       9                 :            : 
#      10                 :            : #include <stdint.h>
#      11                 :            : #include <stdlib.h>
#      12                 :            : 
#      13                 :            : //! The Keccak-f[1600] transform.
#      14                 :            : void KeccakF(uint64_t (&st)[25]);
#      15                 :            : 
#      16                 :            : class SHA3_256
#      17                 :            : {
#      18                 :            : private:
#      19                 :            :     uint64_t m_state[25] = {0};
#      20                 :            :     unsigned char m_buffer[8];
#      21                 :            :     unsigned m_bufsize = 0;
#      22                 :            :     unsigned m_pos = 0;
#      23                 :            : 
#      24                 :            :     //! Sponge rate in bits.
#      25                 :            :     static constexpr unsigned RATE_BITS = 1088;
#      26                 :            : 
#      27                 :            :     //! Sponge rate expressed as a multiple of the buffer size.
#      28                 :            :     static constexpr unsigned RATE_BUFFERS = RATE_BITS / (8 * sizeof(m_buffer));
#      29                 :            : 
#      30                 :            :     static_assert(RATE_BITS % (8 * sizeof(m_buffer)) == 0, "Rate must be a multiple of 8 bytes");
#      31                 :            : 
#      32                 :            : public:
#      33                 :            :     static constexpr size_t OUTPUT_SIZE = 32;
#      34                 :            : 
#      35                 :        156 :     SHA3_256() {}
#      36                 :            :     SHA3_256& Write(Span<const unsigned char> data);
#      37                 :            :     SHA3_256& Finalize(Span<unsigned char> output);
#      38                 :            :     SHA3_256& Reset();
#      39                 :            : };
#      40                 :            : 
#      41                 :            : #endif // BITCOIN_CRYPTO_SHA3_H

Generated by: LCOV version 0-eol-96201-ge66f56f4af6a