I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 1bd5ebd8 authored by zzz's avatar zzz
Browse files

Crypto: Actually use a random nonzero byte in ElGamal,

as our specification says
parent 534609e8
No related branches found
No related tags found
No related merge requests found
...@@ -120,8 +120,10 @@ public final class ElGamalEngine { ...@@ -120,8 +120,10 @@ public final class ElGamalEngine {
long start = _context.clock().now(); long start = _context.clock().now();
byte d2[] = new byte[1+Hash.HASH_LENGTH+data.length]; byte d2[] = new byte[1+Hash.HASH_LENGTH+data.length];
// FIXME this isn't a random nonzero byte! // random nonzero byte
d2[0] = (byte)0xFF; do {
_context.random().nextBytes(d2, 0, 1);
} while (d2[0] == 0);
_context.sha().calculateHash(data, 0, data.length, d2, 1); _context.sha().calculateHash(data, 0, data.length, d2, 1);
System.arraycopy(data, 0, d2, 1+Hash.HASH_LENGTH, data.length); System.arraycopy(data, 0, d2, 1+Hash.HASH_LENGTH, data.length);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment