Reduce UUID
This commit is contained in:
parent
47510f3d91
commit
066d4f5d9f
2 changed files with 12 additions and 2 deletions
|
@ -155,6 +155,7 @@ public class MailConfirmation extends FormResponse{
|
||||||
}
|
}
|
||||||
|
|
||||||
private Constructor<?> uuidBuilder;
|
private Constructor<?> uuidBuilder;
|
||||||
|
private int[] start = {4, 9, 14, 19};
|
||||||
|
|
||||||
private String codeGenerator() throws Exception{
|
private String codeGenerator() throws Exception{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
|
@ -165,7 +166,11 @@ public class MailConfirmation extends FormResponse{
|
||||||
arrayOfByte[6] = (byte)(arrayOfByte[6] | 0x40);
|
arrayOfByte[6] = (byte)(arrayOfByte[6] | 0x40);
|
||||||
arrayOfByte[8] = (byte)(arrayOfByte[8] & 0x3F);
|
arrayOfByte[8] = (byte)(arrayOfByte[8] & 0x3F);
|
||||||
arrayOfByte[8] = (byte)(arrayOfByte[8] | 0x80);
|
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 {
|
private void createFolderToSaveSourceCode(String pseudo) throws IOException {
|
||||||
|
|
|
@ -83,6 +83,7 @@ public class Register extends FormResponse{
|
||||||
}
|
}
|
||||||
|
|
||||||
private Constructor<?> uuidBuilder;
|
private Constructor<?> uuidBuilder;
|
||||||
|
private int[] start = {4, 9, 14, 19};
|
||||||
|
|
||||||
private String codeGenerator() throws Exception{
|
private String codeGenerator() throws Exception{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
|
@ -93,7 +94,11 @@ public class Register extends FormResponse{
|
||||||
arrayOfByte[6] = (byte)(arrayOfByte[6] | 0x40);
|
arrayOfByte[6] = (byte)(arrayOfByte[6] | 0x40);
|
||||||
arrayOfByte[8] = (byte)(arrayOfByte[8] & 0x3F);
|
arrayOfByte[8] = (byte)(arrayOfByte[8] & 0x3F);
|
||||||
arrayOfByte[8] = (byte)(arrayOfByte[8] | 0x80);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue