private static void initDigesters() { digesters.put("Blake2b", Blake2bDigest.class); digesters.put("GOST3411", GOST3411Digest.class); digesters.put("Keccak", KeccakDigest.class); digesters.put("MD2", MD2Digest.class); digesters.put("MD4", MD4Digest.class); digesters.put("MD5", MD5Digest.class); digesters.put("RIPEMD128", RIPEMD128Digest.class); digesters.put("RIPEMD160", RIPEMD160Digest.class); digesters.put("RIPEMD256", RIPEMD256Digest.class); digesters.put("RIPEMD320", RIPEMD320Digest.class); digesters.put("SHA1", SHA1Digest.class); digesters.put("SHA224", SHA224Digest.class); digesters.put("SHA256", SHA256Digest.class); digesters.put("SHA384", SHA384Digest.class); digesters.put("SHA3-512", SHA3Digest.class); digesters.put("SHA3-256", SHA3Digest.class); digesters.put("SHA3-224", SHA3Digest.class); digesters.put("SHA3-384", SHA3Digest.class); digesters.put("SHA512", SHA512Digest.class); digesters.put("SHAKE-128", SHAKEDigest.class); digesters.put("SHAKE-256", SHAKEDigest.class); digesters.put("Skein256", SkeinDigest.class); digesters.put("Skein512", SkeinDigest.class); digesters.put("Skein1024", SkeinDigest.class); digesters.put("SM3", SM3Digest.class); digesters.put("Tiger", TigerDigest.class); digesters.put("Whirlpool", WhirlpoolDigest.class); }
public Object clone() throws CloneNotSupportedException { Blake2b512 d = (Blake2b512)super.clone(); d.digest = new Blake2bDigest((Blake2bDigest)digest); return d; }
public Object clone() throws CloneNotSupportedException { Blake2b384 d = (Blake2b384)super.clone(); d.digest = new Blake2bDigest((Blake2bDigest)digest); return d; }
public Object clone() throws CloneNotSupportedException { Blake2b256 d = (Blake2b256)super.clone(); d.digest = new Blake2bDigest((Blake2bDigest)digest); return d; }
public Object clone() throws CloneNotSupportedException { Blake2b160 d = (Blake2b160)super.clone(); d.digest = new Blake2bDigest((Blake2bDigest)digest); return d; }
public void performTest() throws Exception { // test keyed test vectors: Blake2bDigest blake2bkeyed = new Blake2bDigest(Hex.decode(keyedTestVectors[0][1])); for (int tv = 0; tv < keyedTestVectors.length; tv++) { byte[] input = Hex.decode(keyedTestVectors[tv][0]); blake2bkeyed.reset(); blake2bkeyed.update(input, 0, input.length); byte[] keyedHash = new byte[64]; blake2bkeyed.doFinal(keyedHash, 0); if (!Arrays.areEqual(Hex.decode(keyedTestVectors[tv][2]), keyedHash)) { fail("Blake2b mismatch on test vector ", keyedTestVectors[tv][2], new String(Hex.encode(keyedHash))); } offsetTest(blake2bkeyed, input, keyedHash); } Blake2bDigest blake2bunkeyed = new Blake2bDigest(); // test unkeyed test vectors: for (int i = 0; i < unkeyedTestVectors.length; i++) { try { // blake2bunkeyed.update( // unkeyedTestVectors[i][1].getBytes("UTF-8")); // test update(byte b) byte[] unkeyedInput = unkeyedTestVectors[i][1] .getBytes("UTF-8"); for (int j = 0; j < unkeyedInput.length; j++) { blake2bunkeyed.update(unkeyedInput[j]); } } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } byte[] unkeyedHash = new byte[64]; blake2bunkeyed.doFinal(unkeyedHash, 0); blake2bunkeyed.reset(); if (!Arrays.areEqual(Hex.decode(unkeyedTestVectors[i][0]), unkeyedHash)) { fail("Blake2b mismatch on test vector ", unkeyedTestVectors[i][0], new String(Hex.encode(unkeyedHash))); } } }
public Blake2b512() { super(new Blake2bDigest(512)); }
public Blake2b384() { super(new Blake2bDigest(384)); }
public Blake2b256() { super(new Blake2bDigest(256)); }
public Blake2b160() { super(new Blake2bDigest(160)); }