Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Groovy fix

  • Loading branch information...
commit 65acf0591a4297bf64985774be4a3b3f298cfc8e 1 parent 4036885
Elliott Kember authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 groovy/groovy-Barney-Boisvert
View
10 groovy/groovy-Barney-Boisvert
@@ -9,16 +9,16 @@ String md5(String s) {
digest.reset()
digest.update(s.getBytes())
byte[] md5 = digest.digest()
- StringBuilder sb = new StringBuilder()
- for (byte i : md5) {
- sb.append(Integer.toHexString(0xff & i))
+ s = new BigInteger(1, digest.digest()).toString(16)
+ while (s.length() < 32) {
+ s = "0" + s
}
- return sb.toString()
+ return s
}
start = System.currentTimeMillis()
random = new Random();
-digits = "0123456789ABCDEF"
+digits = "0123456789abcdef"
char[] chars = new char[32];
for (iterations = 1; true; iterations++) {
for (int i = 0; i < chars.length; i++) {
Please sign in to comment.
Something went wrong with that request. Please try again.