From 521c98fdc234298f25b7224c72637efd8ccd609c Mon Sep 17 00:00:00 2001 From: Bartha Maxime <231026@umons.ac.be> Date: Sat, 9 Mar 2024 00:46:40 +0100 Subject: [PATCH] token is now an writable char thanks to the modulos ! --- .../main/java/ovh/herisson/Clyde/Services/TokenService.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/TokenService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/TokenService.java index 4f4e0ad..a82951d 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/TokenService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/TokenService.java @@ -25,11 +25,7 @@ public class TokenService { byte[] bytes = new byte[64]; new SecureRandom().nextBytes(bytes); for (int i = 0; i < bytes.length; i++) { - while (bytes[i] == 0){ - byte[] temp = new byte[1]; - new SecureRandom().nextBytes(temp); - bytes[i] = temp[0]; - } + bytes[i] = (byte) (((bytes[i]+256)%256 %95+ 32)); } // will never end up in the catch because of the way that SecureRandom.nextBytes is implemented try {