LCOV - code coverage report
Current view: top level - src/util - hasher.cpp (source / functions) Coverage Total Hit
Test: test_bitcoin_coverage.info Lines: 100.0 % 12 12
Test Date: 2024-08-28 04:44:32 Functions: 100.0 % 4 4
Branches: 50.0 % 4 2

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2019-2022 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                 :             : #include <crypto/siphash.h>
       6                 :             : #include <random.h>
       7                 :             : #include <span.h>
       8                 :             : #include <util/hasher.h>
       9                 :             : 
      10                 :       14510 : SaltedTxidHasher::SaltedTxidHasher() :
      11                 :       14510 :     k0{FastRandomContext().rand64()},
      12                 :       14510 :     k1{FastRandomContext().rand64()} {}
      13                 :             : 
      14                 :      172490 : SaltedOutpointHasher::SaltedOutpointHasher(bool deterministic) :
      15         [ -  + ]:      172490 :     k0{deterministic ? 0x8e819f2607a18de6 : FastRandomContext().rand64()},
      16         [ +  - ]:      172490 :     k1{deterministic ? 0xf4020d2e3983b0eb : FastRandomContext().rand64()}
      17                 :      172490 : {}
      18                 :             : 
      19                 :         212 : SaltedSipHasher::SaltedSipHasher() :
      20                 :         212 :     m_k0{FastRandomContext().rand64()},
      21                 :         212 :     m_k1{FastRandomContext().rand64()} {}
      22                 :             : 
      23                 :      418937 : size_t SaltedSipHasher::operator()(const Span<const unsigned char>& script) const
      24                 :             : {
      25                 :      418937 :     return CSipHasher(m_k0, m_k1).Write(script).Finalize();
      26                 :             : }
        

Generated by: LCOV version 2.0-1