6061626364656667686970
// // test 2 // byte[] bytes = Hex.decode(testVec2); digest.update(bytes, 0, bytes.length); digest.doFinal(resBuf, 0); resStr = new String(Hex.encode(resBuf)); if (!resVec2.equals(resStr))
8081828384858687888990
// // test 3 // bytes = Hex.decode(testVec3); digest.update(bytes, 0, bytes.length); digest.doFinal(resBuf, 0); resStr = new String(Hex.encode(resBuf)); if (!resVec3.equals(resStr))
100101102103104105106107108109110
// // test 4 // bytes = Hex.decode(testVec4); digest.update(bytes, 0, bytes.length); digest.doFinal(resBuf, 0); resStr = new String(Hex.encode(resBuf)); if (!resVec4.equals(resStr))
120121122123124125126127128129130
// // test 5 // bytes = Hex.decode(testVec4); digest.update(bytes, 0, bytes.length/2); // clone the Digest Digest d = new SHA224Digest((SHA224Digest)digest); digest.update(bytes, bytes.length/2, bytes.length - bytes.length/2);
139140141142143144145146147148149
+ " expected: " + resVec4 + System.getProperty("line.separator") + " got : " + resStr); } d.update(bytes, bytes.length/2, bytes.length - bytes.length/2); d.doFinal(resBuf, 0); resStr = new String(Hex.encode(resBuf)); if (!resVec4.equals(resStr)) {
4748495051525354555657
DataOutputStream dos = new DataOutputStream(new OutputStream() { @Override public void write(int b) { sha.update((byte) b); } @Override public void write(byte[] buf, int off, int len) {
5354555657585960616263
} @Override public void write(byte[] buf, int off, int len) { sha.update(buf, off, len); } }); dos.writeLong(userID); dos.write(passphrase.getBytes(Charset.forName("UTF-8")));