diff --git a/briar-core/src/org/briarproject/crypto/DoubleDigest.java b/briar-core/src/org/briarproject/crypto/DoubleDigest.java index a8670a2171d1b1907d43d11c08d601967aaa9f2e..1d1fdd99d1b5f5d040da4b2bdbf29a97cd0eea5f 100644 --- a/briar-core/src/org/briarproject/crypto/DoubleDigest.java +++ b/briar-core/src/org/briarproject/crypto/DoubleDigest.java @@ -3,6 +3,15 @@ package org.briarproject.crypto; import org.briarproject.api.crypto.MessageDigest; import org.spongycastle.crypto.Digest; +/** + * A message digest that prevents length extension attacks - see Ferguson and + * Schneier, <i>Practical Cryptography</i>, chapter 6. + * <p> + * "Let h be an interative hash function. The hash function h<sub>d</sub> is + * defined by h<sub>d</sub> := h(h(m)), and has a claimed security level of + * min(k, n/2) where k is the security level of h and n is the size of the hash + * result." + */ class DoubleDigest implements MessageDigest { private final Digest delegate;