From 3efd0be63f5727f287ffeba775159823312a60a7 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Fri, 10 May 2024 22:04:24 +0200 Subject: [PATCH] generate secret from range [0..characteristic] in java --- lab3/zad2/app/src/main/java/pl/jacekpoz/User.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lab3/zad2/app/src/main/java/pl/jacekpoz/User.java b/lab3/zad2/app/src/main/java/pl/jacekpoz/User.java index 6cb43f5..54dd073 100644 --- a/lab3/zad2/app/src/main/java/pl/jacekpoz/User.java +++ b/lab3/zad2/app/src/main/java/pl/jacekpoz/User.java @@ -10,7 +10,7 @@ public class User> { public User(final IDHSetup dh) { Random rand = new Random(); - this.secret = rand.nextLong(0, Long.MAX_VALUE); + this.secret = rand.nextLong(0, dh.getGenerator().getCharacteristic()); this.dh = dh; }