From e618ff9565b6da899cb13fae940e8b8649bb2fdd Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 19 Jan 2018 19:33:34 +0200 Subject: [PATCH] Test --- iguana/segwit_addr.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/iguana/segwit_addr.c b/iguana/segwit_addr.c index 33a56562d..a190b082e 100644 --- a/iguana/segwit_addr.c +++ b/iguana/segwit_addr.c @@ -71,23 +71,27 @@ int bech32_encode(char *output, const char *hrp, const uint8_t *data, size_t dat } if (ch >= 'A' && ch <= 'Z') return 0; - chk = bech32_polymod_step(chk) ^ (ch >> 5); + //chk = bech32_polymod_step(chk) ^ (ch >> 5); + chk = PolyMod_step(chk,ch >> 5); ++i; } if (i + 7 + data_len > 90) return 0; chk = bech32_polymod_step(chk); while (*hrp != 0) { - chk = bech32_polymod_step(chk) ^ (*hrp & 0x1f); + //chk = bech32_polymod_step(chk) ^ (*hrp & 0x1f); + chk = PolyMod_step(chk,*hrp & 0x1f); *(output++) = *(hrp++); } *(output++) = BECH32_DELIM; for (i = 0; i < data_len; ++i) { if (*data >> 5) return 0; - chk = bech32_polymod_step(chk) ^ (*data); + //chk = bech32_polymod_step(chk) ^ (*data); + chk = PolyMod_step(chk,*data); *(output++) = charset[*(data++)]; } for (i = 0; i < 6; ++i) { - chk = bech32_polymod_step(chk); + //chk = bech32_polymod_step(chk); + chk = PolyMod_step(chk,0); } chk ^= 1; for (i = 0; i < 6; ++i) {