Last active
August 29, 2015 14:05
-
-
Save JamoCA/eeb92f8fed6764110553 to your computer and use it in GitHub Desktop.
Sample Implementation of the ColdFusion hashids library http://www.hashids.org/coldfusion/
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
<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