iRule hashing + trim

Hello Devcentral community,

Please can you tell me how to a hash a variable like the sha 512 (i store a certain parameter value by the uri ) and after that i want to keep only the last 10 characters of the sha.

Variable Variablehash--> hashed sha512 of $variable

Than, only the last 10 characters of the $Variablehash

One more question: how i can inspect the response page that returns to the client ( passing from the BIG-IP ) and if a certain string in the HTML body is present than i ll generate a message ( hsl)?

Thanks in advance,

Best Regards,

Matteo

Hello, anyone can give me a suggestion ?

Thanks

Try this for your hash variable:

set variableHash [sha512 $variable]
set lastTenHash [string range $variableHash [expr [string length $variableHash] - 10] end]

For your response you would need to do a

HTTP::collect [HTTP::header Content-Length]

in your when HTTP_RESPONSE event and then in the HTTP_RESPONSE_DATA event you would need to inspect the HTTP::payload for your string probably using scan. Be weary, that this will collect the whole payload of every response which could be a performance hit to the application.