damus-c: add bolt11 parser from CLN

We'll need this for our lightning invoice view

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-10-19 07:45:06 -07:00
parent c4206883f2
commit dbe1260b54
44 changed files with 8280 additions and 0 deletions

20
damus-c/hash_u5.h Normal file
View File

@@ -0,0 +1,20 @@
/* bech32 (thus bolt11) deal in 5-bit values */
#ifndef LIGHTNING_COMMON_HASH_U5_H
#define LIGHTNING_COMMON_HASH_U5_H
#include "sha256.h"
#include "short_types.h"
/* Type to annotate a 5 bit value. */
typedef unsigned char u5;
struct hash_u5 {
u64 buf;
unsigned int num_bits;
struct sha256_ctx hash;
};
void hash_u5_init(struct hash_u5 *hu5, const char *hrp);
void hash_u5(struct hash_u5 *hu5, const u5 *u5, size_t len);
void hash_u5_done(struct hash_u5 *hu5, struct sha256 *res);
#endif /* LIGHTNING_COMMON_HASH_U5_H */