Reduce UUID

This commit is contained in:
jeffcheasey88 2024-09-17 09:11:22 +02:00
parent 47510f3d91
commit 066d4f5d9f
2 changed files with 12 additions and 2 deletions

View file

@ -155,6 +155,7 @@ public class MailConfirmation extends FormResponse{
}
private Constructor<?> uuidBuilder;
private int[] start = {4, 9, 14, 19};
private String codeGenerator() throws Exception{
Random random = new Random();
@ -165,7 +166,11 @@ public class MailConfirmation extends FormResponse{
arrayOfByte[6] = (byte)(arrayOfByte[6] | 0x40);
arrayOfByte[8] = (byte)(arrayOfByte[8] & 0x3F);
arrayOfByte[8] = (byte)(arrayOfByte[8] | 0x80);
return uuidBuilder.newInstance(arrayOfByte).toString();
String uuid = uuidBuilder.newInstance(arrayOfByte).toString();
target = this.randoms.get(random.nextInt(this.randoms.size()));
int start = this.start[target.nextInt(this.start.length)];
return uuid.substring(start, start+9);
}
private void createFolderToSaveSourceCode(String pseudo) throws IOException {

View file

@ -83,6 +83,7 @@ public class Register extends FormResponse{
}
private Constructor<?> uuidBuilder;
private int[] start = {4, 9, 14, 19};
private String codeGenerator() throws Exception{
Random random = new Random();
@ -93,7 +94,11 @@ public class Register extends FormResponse{
arrayOfByte[6] = (byte)(arrayOfByte[6] | 0x40);
arrayOfByte[8] = (byte)(arrayOfByte[8] & 0x3F);
arrayOfByte[8] = (byte)(arrayOfByte[8] | 0x80);
return uuidBuilder.newInstance(arrayOfByte).toString();
String uuid = uuidBuilder.newInstance(arrayOfByte).toString();
target = this.randoms.get(random.nextInt(this.randoms.size()));
int start = this.start[target.nextInt(this.start.length)];
return uuid.substring(start, start+9);
}
}