Skip to content

Instantly share code, notes, and snippets.

@isapir
Last active May 4, 2022 17:49
Show Gist options
  • Save isapir/0b509b986bd22130f48d38ab1f1f7869 to your computer and use it in GitHub Desktop.
Save isapir/0b509b986bd22130f48d38ab1f1f7869 to your computer and use it in GitHub Desktop.
<cfscript>
algorithm = "PBKDF2withHmacSha512";
passphrase = "The passphrase is passphrase";
// 16 random characters
salt = left(replace(createUUID(), "-", "", "all"), 16);
// approx. 300ms at the time of testing
iterations = 100000;
subkeySize = 256;
pbkdfKey = generatePBKDFKey(algorithm, passphrase, salt, iterations, subkeySize);
storedHash = salt & "." & pbkdfKey;
dump(storedHash);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment