Forum Discussion

Chuck_13207's avatar
Chuck_13207
Icon for Nimbostratus rankNimbostratus
Sep 06, 2012

Obtaining MD5 hash of a string

So when I try and do this

 

 

set HASH [ md5 $var1]

 

 

The var $HASH is just junk and not a MD5 hash string. Can someone point me in the right direction?

 

2 Replies

  • MD5 produces a binary object in iRules.

    https://devcentral.f5.com/wiki/iRules.md5.ashx

    To see what you'd expect from something like md5sum, do a binary scan and convert to hex:

     
    when HTTP_REQUEST {
    set var1 "this is a test"
    binary scan [md5 $var1] H* key
    log local0. $key
    }
    

    ** create a file and enter "this is a test" as its contents, then run md5sum against that file. You'll get the same value.

  • I had just found that and was getting ready to post that I did.

     

     

    thank you for replying