Created
May 30, 2013 01:09
-
-
Save kelvinewilliams/5675140 to your computer and use it in GitHub Desktop.
Returns 90 character string. Used for passphrases. Replace "[sprinkles]" with characters you want to sprinkle in. :)
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
private static String createPassphrase() { | |
long currentTime = System.nanoTime(); | |
char[] x = ("[sprinkles]").toCharArray(); | |
StringBuilder stringBuilder = new StringBuilder(); | |
for (char s : x) { | |
stringBuilder.append("" + currentTime); | |
stringBuilder.append(s); | |
} | |
try { | |
MessageDigest messageDigest = MessageDigest.getInstance("SHA-512"); | |
return Base64.encodeToString(messageDigest.digest(stringBuilder.toString().getBytes("UTF-8")), Base64.DEFAULT); | |
} catch (NoSuchAlgorithmException e) { | |
e.printStackTrace(); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment