In ColdFusion 9, I am hashing a string like so: hash("bob", "SHA1"), I need it to return binary instead of a hex string.
Since you know the hashed string is in hex, simply decode it with the aptly named binaryDecode() function.
hashedString = hash("bob", "SHA1");
binaryData = binaryDecode(hashedString , "Hex");
Is this the sort of thing yer after?
<cfscript>
s = "G'day World";
hash1 = hash(s, "SHA-1");
bin = binaryDecode(hash1, "hex");
hash2 = binaryEncode(bin, "hex");
writeDump(variables);
</cfscript>

Docs:
BinaryDecode()BinaryEncode()If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With