6162636465666768697071
// // 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))
8182838485868788899091
// // 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))
101102103104105106107108109110111
// // 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))
121122123124125126127128129130131
// // test 5 // bytes = Hex.decode(testVec4); digest.update(bytes, 0, bytes.length/2); // clone the Digest Digest d = new SHA512Digest((SHA512Digest)digest); digest.update(bytes, bytes.length/2, bytes.length - bytes.length/2);
140141142143144145146147148149150
+ " 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)) {
346347348349350351352353354355356
* @return the digest as a byte array. */ public byte[] calculatePublicKeyRingDigest() { final SHA512Digest dig = new SHA512Digest(); dig.reset(); dig.update(publicKeyRing, 0, publicKeyRing.length); final byte[] digest = new byte[dig.getDigestSize()]; dig.doFinal(digest, 0); return digest; }