forked from I2P_Developers/i2p.i2p
Crypto: Actually use a random nonzero byte in ElGamal,
as our specification says
This commit is contained in:
@ -120,8 +120,10 @@ public final class ElGamalEngine {
|
||||
long start = _context.clock().now();
|
||||
|
||||
byte d2[] = new byte[1+Hash.HASH_LENGTH+data.length];
|
||||
// FIXME this isn't a random nonzero byte!
|
||||
d2[0] = (byte)0xFF;
|
||||
// random nonzero byte
|
||||
do {
|
||||
_context.random().nextBytes(d2, 0, 1);
|
||||
} while (d2[0] == 0);
|
||||
_context.sha().calculateHash(data, 0, data.length, d2, 1);
|
||||
System.arraycopy(data, 0, d2, 1+Hash.HASH_LENGTH, data.length);
|
||||
|
||||
|
Reference in New Issue
Block a user