nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

hash_u5.h (581B)


      1 /* bech32 (thus bolt11) deal in 5-bit values */
      2 #ifndef LIGHTNING_COMMON_HASH_U5_H
      3 #define LIGHTNING_COMMON_HASH_U5_H
      4 #include "ccan/crypto/sha256/sha256.h"
      5 #include "ccan/short_types/short_types.h"
      6 
      7 /* Type to annotate a 5 bit value. */
      8 typedef unsigned char u5;
      9 
     10 struct hash_u5 {
     11     u64 buf;
     12         unsigned int num_bits;
     13         struct sha256_ctx hash;
     14 };
     15 
     16 void hash_u5_init(struct hash_u5 *hu5, const char *hrp);
     17 void hash_u5(struct hash_u5 *hu5, const u5 *u5, size_t len);
     18 void hash_u5_done(struct hash_u5 *hu5, struct sha256 *res);
     19 
     20 #endif /* LIGHTNING_COMMON_HASH_U5_H */