csecp256k1

Haskell FFI bindings to bitcoin-core/secp256k1 (docs.ppad.tech/csecp256k1).
git clone git://git.ppad.tech/csecp256k1.git
Log | Files | Refs | README | LICENSE

hash.h (2009B)


      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 } haskellsecp256k1_v0_1_0_sha256;
     18 
     19 static void haskellsecp256k1_v0_1_0_sha256_initialize(haskellsecp256k1_v0_1_0_sha256 *hash);
     20 static void haskellsecp256k1_v0_1_0_sha256_write(haskellsecp256k1_v0_1_0_sha256 *hash, const unsigned char *data, size_t size);
     21 static void haskellsecp256k1_v0_1_0_sha256_finalize(haskellsecp256k1_v0_1_0_sha256 *hash, unsigned char *out32);
     22 
     23 typedef struct {
     24     haskellsecp256k1_v0_1_0_sha256 inner, outer;
     25 } haskellsecp256k1_v0_1_0_hmac_sha256;
     26 
     27 static void haskellsecp256k1_v0_1_0_hmac_sha256_initialize(haskellsecp256k1_v0_1_0_hmac_sha256 *hash, const unsigned char *key, size_t size);
     28 static void haskellsecp256k1_v0_1_0_hmac_sha256_write(haskellsecp256k1_v0_1_0_hmac_sha256 *hash, const unsigned char *data, size_t size);
     29 static void haskellsecp256k1_v0_1_0_hmac_sha256_finalize(haskellsecp256k1_v0_1_0_hmac_sha256 *hash, unsigned char *out32);
     30 
     31 typedef struct {
     32     unsigned char v[32];
     33     unsigned char k[32];
     34     int retry;
     35 } haskellsecp256k1_v0_1_0_rfc6979_hmac_sha256;
     36 
     37 static void haskellsecp256k1_v0_1_0_rfc6979_hmac_sha256_initialize(haskellsecp256k1_v0_1_0_rfc6979_hmac_sha256 *rng, const unsigned char *key, size_t keylen);
     38 static void haskellsecp256k1_v0_1_0_rfc6979_hmac_sha256_generate(haskellsecp256k1_v0_1_0_rfc6979_hmac_sha256 *rng, unsigned char *out, size_t outlen);
     39 static void haskellsecp256k1_v0_1_0_rfc6979_hmac_sha256_finalize(haskellsecp256k1_v0_1_0_rfc6979_hmac_sha256 *rng);
     40 
     41 #endif /* SECP256K1_HASH_H */