Forum Discussion

mhuss3y_61750's avatar
mhuss3y_61750
Icon for Nimbostratus rankNimbostratus
Feb 20, 2014

sha256 function incorrect output

Hi devcentral, when using the sha256 function to hash a string I am unable to replicate the online sha hash function. For example, if I enter the string "myhash" without the quotes into: http://www.xorbin.com/tools/sha256-hash-calculator I receive: e037f671bf37164c071d526e8960fd9122383d5d73ef3b60f1bc9f330a15c1e1

However when this is done using the sha256 iRule function I get: à 7öq¿7LRnÂ

ýÂ"8=]sï;
ñ¼Â3 Ãá

which seems like I have the wrong encoding somewhere?

thanks in advance!!

3 Replies

  • The online tool you are using displays the hex encoding of the hash. The iRule function is raw binary. I am NOT an iRule or TCL guy, but I think you can use this to convert to a hex string:

     

    http://tmml.sourceforge.net/doc/tcl/binary.html

     

    Good luck,

     

    -M