CRYPTO::hash

Description

This iRules command generates a hash on a piece of data

Syntax

CRYPTO::hash  [-alg <>] [-ctx <> [-final]] [<data>]

CRYPTO::hash [-alg <>] [-ctx <> [-final]] [<data>]

  • Generates a hash on a piece of data

Algorithm List

  • md5
  • ripemd160
  • sha1
  • sha224
  • sha256
  • sha384
  • sha512

Examples

when HTTP_REQUEST {
if {[class match [b64encode [CRYPTO::hash -alg sha384 [HTTP::host][HTTP::path]]] equals HASH ]} {
    log local0. " this FQDN + PATH is mathing - [HTTP::host][HTTP::path]"
}
}

This example shows how CRYPTO::hash command can be used by hashing the FQDN and PATH of a URI, and checking if this matches a DATAGROUP (called HASH) composed of externally hashed URLs. The hashed URLs in the DATAGROUP, are given by an external company, and hashed to avoid reverse engineering of the URL DB. The goal of the iRule is to check if there is a match in this HASHED URL DB.