fixed a token encoding issue #70
@ -25,11 +25,7 @@ public class TokenService {
|
|||||||
byte[] bytes = new byte[64];
|
byte[] bytes = new byte[64];
|
||||||
new SecureRandom().nextBytes(bytes);
|
new SecureRandom().nextBytes(bytes);
|
||||||
Maxime marked this conversation as resolved
|
|||||||
for (int i = 0; i < bytes.length; i++) {
|
for (int i = 0; i < bytes.length; i++) {
|
||||||
while (bytes[i] == 0){
|
bytes[i] = (byte) (((bytes[i]+256)%256 %95+ 32));
|
||||||
Maxime
commented
Permet d'avoir des caractères affichable Permet d'avoir des caractères affichable
|
|||||||
byte[] temp = new byte[1];
|
|
||||||
new SecureRandom().nextBytes(temp);
|
|
||||||
bytes[i] = temp[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// will never end up in the catch because of the way that SecureRandom.nextBytes is implemented
|
// will never end up in the catch because of the way that SecureRandom.nextBytes is implemented
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user
je suis un peu curieux de la différence avec Random()
random est moins random et plus prévisible donc plus de conflits (on m'a juste conseillé SecureRandom donc sur un site donc voila
)