From 19da077fbdd723f00d40ab61fe2d77ef3d06ea18 Mon Sep 17 00:00:00 2001 From: QuincySx <772804430@qq.com> Date: Tue, 15 May 2018 14:22:46 +0800 Subject: [PATCH] =?UTF-8?q?delete=20=E5=8A=A9=E8=AE=B0=E8=AF=8D=20InvalidC?= =?UTF-8?q?hecksumException=20=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crypto/bip39/MnemonicValidator.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/library/src/main/java/com/quincysx/crypto/bip39/MnemonicValidator.java b/library/src/main/java/com/quincysx/crypto/bip39/MnemonicValidator.java index f4b0e22..c21ab4e 100644 --- a/library/src/main/java/com/quincysx/crypto/bip39/MnemonicValidator.java +++ b/library/src/main/java/com/quincysx/crypto/bip39/MnemonicValidator.java @@ -91,21 +91,21 @@ private static void validate(final int[] wordIndexes) throws final int cs = ent / 32; if (entPlusCs != ent + cs) throw new InvalidWordCountException(); - final byte[] entropyWithChecksum = new byte[(entPlusCs + 7) / 8]; - - wordIndexesToEntropyWithCheckSum(wordIndexes, entropyWithChecksum); - Arrays.fill(wordIndexes, 0); - - final byte[] entropy = Arrays.copyOf(entropyWithChecksum, entropyWithChecksum.length - 1); - final byte lastByte = entropyWithChecksum[entropyWithChecksum.length - 1]; - Arrays.fill(entropyWithChecksum, (byte) 0); - - final byte sha = MnemonicGenerator.firstByteOfSha256(entropy); - - final byte mask = maskOfFirstNBits(cs); - - if (((sha ^ lastByte) & mask) != 0) - throw new InvalidChecksumException(); +// final byte[] entropyWithChecksum = new byte[(entPlusCs + 7) / 8]; +// +// wordIndexesToEntropyWithCheckSum(wordIndexes, entropyWithChecksum); +// Arrays.fill(wordIndexes, 0); +// +// final byte[] entropy = Arrays.copyOf(entropyWithChecksum, entropyWithChecksum.length - 1); +// final byte lastByte = entropyWithChecksum[entropyWithChecksum.length - 1]; +// Arrays.fill(entropyWithChecksum, (byte) 0); + +// final byte sha = MnemonicGenerator.firstByteOfSha256(entropy); +// +// final byte mask = maskOfFirstNBits(cs); +// +// if (((sha ^ lastByte) & mask) != 0) +// throw new InvalidChecksumException(); } private int[] findWordIndexes(final Collection split) throws