From 08854d0f82acbf1fbb603e736543bf41f598a6bb Mon Sep 17 00:00:00 2001 From: kamaci Date: Thu, 1 Mar 2018 22:45:53 +0300 Subject: [PATCH] All the higher bits are turned off back due to byte values are automatically promoted when reading bytes in order to build ints. --- src/main/java/info/weboftrust/txrefconversion/Bech32.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/info/weboftrust/txrefconversion/Bech32.java b/src/main/java/info/weboftrust/txrefconversion/Bech32.java index 32554b9..5f7166f 100644 --- a/src/main/java/info/weboftrust/txrefconversion/Bech32.java +++ b/src/main/java/info/weboftrust/txrefconversion/Bech32.java @@ -85,7 +85,7 @@ private static int polymod(byte[] values) { for (byte b : values) { byte top = (byte)(chk >> 0x19); - chk = b ^ ((chk & 0x1ffffff) << 5); + chk = ((0xff) & b) ^ ((chk & 0x1ffffff) << 5); for (int i = 0; i < 5; i++) { chk ^= ((top >> i) & 1) == 1 ? GENERATORS[i] : 0; }