Created
July 11, 2025 07:32
-
-
Save trycf/91d698331db35da7d84e27dcd32b1632 to your computer and use it in GitHub Desktop.
TryCF Gist
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> | |
// Use a 16-byte (128-bit) AES key | |
key = "12345678901234567890123456789012"; // 16 characters | |
// Text to encrypt | |
originalText = "kiosk"; | |
// Encrypt the text (returns Base64 string) | |
encryptedBinary = encrypt(originalText, key, "AES", "Base64"); | |
// Decrypt using ToString(ToBinary()) (works only for simple round-trip) | |
decryptedText = ToString(ToBinary(encryptedBinary)); | |
// Or safer: use the decrypt() function | |
safeDecrypted = decrypt(encryptedBinary, key, "AES", "Base64"); | |
// Output | |
writeOutput("Original Text: " & originalText & "<br>"); | |
writeOutput("Encrypted (Base64): " & encryptedBinary & "<br>"); | |
writeOutput("Decrypted via ToString(toBinary()): " & decryptedText & "<br>"); | |
writeOutput("Decrypted via decrypt(): " & safeDecrypted); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment