Java userspace test (contrib/external-tests/java)

Jason A. Donenfeld Jason at
Tue Apr 18 03:54:44 CEST 2017

>From your code:

Blake2sMessageDigest blake2s = new Blake2sMessageDigest(preshared);
blake2s.update(buf.array(), 0, buf.position());
// Note: Blake2s returns 32 bytes, but we only use the first 16.
buf.put(blake2s.digest(), 0, 16);

The final length needs to be passed to Blake2sMessageDigest in the
constructor, because Blake2 encodes the final length into the initial
block. The implementation from here might work better:

More information about the WireGuard mailing list