diff --git a/src/main/java/org/stellar/sdk/KeyPair.java b/src/main/java/org/stellar/sdk/KeyPair.java index 6c7f8e340..1c71185e9 100644 --- a/src/main/java/org/stellar/sdk/KeyPair.java +++ b/src/main/java/org/stellar/sdk/KeyPair.java @@ -272,7 +272,7 @@ public DecoratedSignature signPayloadDecorated(byte[] signerPayload) { //XOR the new hint with this keypair's public key hint for (int i = 0; i < hint.length; i++) { - hint[i] ^= (i < payloadSignature.getHint().getSignatureHint().length ? payloadSignature.getHint().getSignatureHint()[i] : 0); + hint[i] ^= payloadSignature.getHint().getSignatureHint()[i]; } payloadSignature.getHint().setSignatureHint(hint); return payloadSignature; diff --git a/src/test/java/org/stellar/sdk/KeyPairTest.java b/src/test/java/org/stellar/sdk/KeyPairTest.java index db1b564eb..2d9b661f4 100644 --- a/src/test/java/org/stellar/sdk/KeyPairTest.java +++ b/src/test/java/org/stellar/sdk/KeyPairTest.java @@ -98,11 +98,7 @@ public void testSignPayloadSigner() { byte[] payload = new byte[]{1,2,3,4,5}; DecoratedSignature sig = keypair.signPayloadDecorated(payload); - Assert.assertArrayEquals(sig.getHint().getSignatureHint(), new byte[]{ - (byte)(0xFF & 252), - (byte)(0xFF & 65), - (byte)(0), - (byte)(0xFF & 50)}); + Assert.assertArrayEquals(sig.getHint().getSignatureHint(), new byte[]{(byte)(0xFF & 252), 65, 0, 50}); } @@ -114,11 +110,6 @@ public void testSignPayloadSignerLessThanHint() { byte[] payload = new byte[]{1,2,3}; DecoratedSignature sig = keypair.signPayloadDecorated(payload); // the hint could only be derived off of 3 bytes from payload - Assert.assertArrayEquals(sig.getHint().getSignatureHint(), new byte[]{ - (byte)(255), - (byte)(0xFF & 64), - (byte)(0xFF & 7), - (byte)(0xFF & 55)}); - + Assert.assertArrayEquals(sig.getHint().getSignatureHint(), new byte[]{(byte)(255), 64, 7, 55}); } }