-
-
Save ivanionut/25b10090380e14978ffe to your computer and use it in GitHub Desktop.
Sample Implementation of the ColdFusion hashids library http://www.hashids.org/coldfusion/
This file contains hidden or 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
<cfscript> | |
/* Download and install the hashids CFC https://github.com/dswitzer/hashids.coldfusion */ | |
hashids = new Hashids(salt="this is my salt" | |
,minLen=8 | |
,alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"); | |
id_to_hash = listtoArray("1"); // try "1,2,3" and "3,2,1" and "1,1,1" | |
writeoutput('original = #arrayToList(id_to_hash)#<br>'); | |
hashed_id = hashids.encrypt(id_to_hash); | |
writeoutput('hash = #hashed_id#<br>'); | |
unhashed_id = arraytolist(hashids.decrypt(hashed_id)); | |
writeoutput('unhashed = #unhashed_id#<br>'); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment