Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<cffunction name="genSalt" access="public" returnType="string">
<cfargument name="size" type="numeric" required="false" default="16" />
<cfscript>
var byteType = createObject('java', 'java.lang.Byte').TYPE;
var bytes = createObject('java','java.lang.reflect.Array').newInstance( byteType , size);
var rand = createObject('java', 'java.security.SecureRandom').nextBytes(bytes);
return toBase64(bytes);
</cfscript>
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment