You need to use the ColdFusion provided function for converting binary representation to string using toString(xxx)
and not the underlying java function xxx.toString()
as both will render different result. This sounds strange but it is not, java is hard typed language you cannot simply convert a binary data to a string representation like that, refer to this post. Also, if you would have noticed in your original CF code the output is different every time you run it.
Going back to your problem, you just need to make a little change and it works fine:
<cfset key="43480170" />
<cfoutput>#toString(binaryDecode(key, "hex" ))#</cfoutput>
You can run the code here to check the difference in output between the two approaches.
Update:
Following the useful comment by @Leigh on the recommended way to perform a binary to string conversion using the CharsetEncode()
function, the code would result to:
<cfset key="43480170" />
<cfoutput>#CharsetEncode(binaryDecode(key, "hex" ),'utf-8')#</cfoutput>
You can check the updated gist with the changes.