From 24c241342e4267b6f6bc7e19674d5210422f9e3d Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 19 Jan 2018 20:44:13 +0200 Subject: [PATCH] Test --- iguana/segwit_addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/segwit_addr.c b/iguana/segwit_addr.c index 6fba18d09..b371b23c1 100644 --- a/iguana/segwit_addr.c +++ b/iguana/segwit_addr.c @@ -108,7 +108,7 @@ int bech32_encode(char *output, const char *hrp, const uint8_t *data, size_t dat } chk ^= 1; for (i = 0; i < chklen; ++i) { - *(output++) = charset[(chk >> ((5 - i) * 5)) & 0x1f]; + *(output++) = charset[(chk >> ((checklen - 1 - i) * 5)) & 0x1f]; } *output = 0; printf("checksum %llx\n",(long long)chk);