Returns an array containing the names of all supported hashes.
getSupportedHashes()
Return | An array containing the names of all hashes supported by this module |
This function can be used to check if different versions of the module support a specific hash.
Convenience function that calculates a hash.
hash( raw, which, [data] )
raw | If set to true, return a raw MemBuf instead of a string. | ||||
which | Hash that should be used | ||||
data | ... Arbitrary amount of parameters that should be fed into the chosen hash function. | ||||
Return | A lowercase hexadecimal string with the output of the chosen hash if raw is false, or a 1-byte wide MemBuf if true. | ||||
Raise |
|
This function takes an arbitrary amount of parameters. See HashBase.update() for details.
Param which can contain a String with the name of the hash, a hash class constructor, a not-finalized hash object, or a function that returns any of the latter.
Note: Use getSupportedHashes() to check which hash names are supported.
Note: If which is a hash object, it will be finalized by calling this function.
Provides HMAC authentication for a block of data
hmac( raw, which, key, data )
raw | If set to true, return a raw MemBuf instead of a string. | ||||
which | Hash that should be used | ||||
key | Secret authentication key | ||||
data | The data to be authenticated | ||||
Return | A lowercase hexadecimal string with the HMAC-result of the chosen hash if raw is false, or a 1-byte wide MemBuf if true. | ||||
Raise |
|
Param key can be a String or a MemBuf.
Param which can contain a String with the name of the hash, a hash class constructor, or a function that returns a useable hash object. Unlike the hash() function, it is not possible to pass a hash object directly, because it would have to be used 3 times, which is not possible because of finalization.
In total, this function evaluates which 3 times, creating 3 hash objects internally.
Note: Use getSupportedHashes() to check which hash names are supported.
Creates a hash object based on the algorithm name
makeHash( name, [silent] )
name | The name of the algorithm (case insensitive) | ||
silent | Return nil instead of throwing an exception, if the hash was not found | ||
Return | A new instance of a hash object of the the given algorithm name | ||
Raise |
|
Note: Use getSupportedHashes() to check which hash names are supported.