generate secret from range [0..characteristic] in java

This commit is contained in:
jacekpoz 2024-05-10 22:04:24 +02:00
parent e659fcd51a
commit 3efd0be63f
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -10,7 +10,7 @@ public class User<T extends IGF, D extends IDHSetup<T>> {
public User(final IDHSetup<T> dh) {
Random rand = new Random();
this.secret = rand.nextLong(0, Long.MAX_VALUE);
this.secret = rand.nextLong(0, dh.getGenerator().getCharacteristic());
this.dh = dh;
}