Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
137 changed files
with
25,746 additions
and
25,720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 43 additions & 43 deletions
86
grobid-core/src/main/java/org/grobid/core/utilities/KeyGen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
package org.grobid.core.utilities; | ||
|
||
/** | ||
* Generate a random key. | ||
* | ||
* @author Florian Zipser | ||
*/ | ||
public class KeyGen { | ||
/** | ||
* Minimum length for a decent key | ||
*/ | ||
public static final int MIN_LENGTH = 10; | ||
|
||
/** | ||
* The random number generator. | ||
*/ | ||
protected static java.util.Random r = new java.util.Random(); | ||
|
||
/** | ||
* Set of characters that is valid. Must be printable, memorable, and "won't | ||
* break HTML" (i.e., not ' <', '>', '&', '=', ...). or break shell commands | ||
* (i.e., not ' <', '>', '$', '!', ...). I, L and O are good to leave out, | ||
* as are numeric zero and one. | ||
*/ | ||
protected static final char[] goodChar = {'a', 'b', 'c', 'd', 'e', 'f', 'g', | ||
'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', | ||
'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', | ||
'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', | ||
'2', '3', '4', '5', '6', '7', '8', '9'}; | ||
|
||
/** | ||
* Generate a Password object with a random password. | ||
* @return a generated key | ||
*/ | ||
public static String getKey() { | ||
StringBuilder sb = new StringBuilder(); | ||
for (int i = 0; i < MIN_LENGTH; i++) { | ||
sb.append(goodChar[r.nextInt(goodChar.length)]); | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
} | ||
package org.grobid.core.utilities; | ||
|
||
/** | ||
* Generate a random key. | ||
* | ||
* @author Florian Zipser | ||
*/ | ||
public class KeyGen { | ||
/** | ||
* Minimum length for a decent key | ||
*/ | ||
public static final int MIN_LENGTH = 10; | ||
|
||
/** | ||
* The random number generator. | ||
*/ | ||
protected static java.util.Random r = new java.util.Random(); | ||
|
||
/** | ||
* Set of characters that is valid. Must be printable, memorable, and "won't | ||
* break HTML" (i.e., not ' <', '>', '&', '=', ...). or break shell commands | ||
* (i.e., not ' <', '>', '$', '!', ...). I, L and O are good to leave out, | ||
* as are numeric zero and one. | ||
*/ | ||
protected static final char[] goodChar = {'a', 'b', 'c', 'd', 'e', 'f', 'g', | ||
'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', | ||
'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', | ||
'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', | ||
'2', '3', '4', '5', '6', '7', '8', '9'}; | ||
|
||
/** | ||
* Generate a Password object with a random password. | ||
* @return a generated key | ||
*/ | ||
public static String getKey() { | ||
StringBuilder sb = new StringBuilder(); | ||
for (int i = 0; i < MIN_LENGTH; i++) { | ||
sb.append(goodChar[r.nextInt(goodChar.length)]); | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.