github.com/ethereum/go-ethereum@v1.16.1/crypto/secp256k1/libsecp256k1/src/hash.h (about)

     1  /***********************************************************************
     2   * Copyright (c) 2014 Pieter Wuille                                    *
     3   * Distributed under the MIT software license, see the accompanying    *
     4   * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
     5   ***********************************************************************/
     6  
     7  #ifndef SECP256K1_HASH_H
     8  #define SECP256K1_HASH_H
     9  
    10  #include <stdlib.h>
    11  #include <stdint.h>
    12  
    13  typedef struct {
    14      uint32_t s[8];
    15      unsigned char buf[64];
    16      uint64_t bytes;
    17  } secp256k1_sha256;
    18  
    19  static void secp256k1_sha256_initialize(secp256k1_sha256 *hash);
    20  static void secp256k1_sha256_write(secp256k1_sha256 *hash, const unsigned char *data, size_t size);
    21  static void secp256k1_sha256_finalize(secp256k1_sha256 *hash, unsigned char *out32);
    22  static void secp256k1_sha256_clear(secp256k1_sha256 *hash);
    23  
    24  typedef struct {
    25      secp256k1_sha256 inner, outer;
    26  } secp256k1_hmac_sha256;
    27  
    28  static void secp256k1_hmac_sha256_initialize(secp256k1_hmac_sha256 *hash, const unsigned char *key, size_t size);
    29  static void secp256k1_hmac_sha256_write(secp256k1_hmac_sha256 *hash, const unsigned char *data, size_t size);
    30  static void secp256k1_hmac_sha256_finalize(secp256k1_hmac_sha256 *hash, unsigned char *out32);
    31  static void secp256k1_hmac_sha256_clear(secp256k1_hmac_sha256 *hash);
    32  
    33  typedef struct {
    34      unsigned char v[32];
    35      unsigned char k[32];
    36      int retry;
    37  } secp256k1_rfc6979_hmac_sha256;
    38  
    39  static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256 *rng, const unsigned char *key, size_t keylen);
    40  static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256 *rng, unsigned char *out, size_t outlen);
    41  static void secp256k1_rfc6979_hmac_sha256_finalize(secp256k1_rfc6979_hmac_sha256 *rng);
    42  static void secp256k1_rfc6979_hmac_sha256_clear(secp256k1_rfc6979_hmac_sha256 *rng);
    43  
    44  #endif /* SECP256K1_HASH_H */