mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +01:00
Allow output shorter than getDigestSize().
This commit is contained in:
@@ -26,8 +26,9 @@ class DigestWrapper implements MessageDigest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int digest(byte[] buf, int offset, int len) {
|
public int digest(byte[] buf, int offset, int len) {
|
||||||
if (len != digest.getDigestSize()) throw new IllegalArgumentException();
|
byte[] hash = digest();
|
||||||
digest.doFinal(buf, offset);
|
len = Math.min(len, hash.length);
|
||||||
|
System.arraycopy(hash, 0, buf, offset, len);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user