ballerina.security.crypto package

public function getHash ( string baseString , Algorithm algorithm ) ( string )

Returns the hash of the given string using the specified algorithm.

Parameter Name Data Type Description
baseString string The string to be hashed
algorithm Algorithm The hashing algorithm to be used

public function getHmac ( string baseString , string keyString , Algorithm algorithm ) ( string )

Returns the HMAC value of the provided base string.

Parameter Name Data Type Description
baseString string The string to be hashed
keyString string The key string
algorithm Algorithm The hashing algorithm to be used

public enum Algorithm

The algorithms which can be used in crypto functions.

Name Description
SHA1 SHA1 algorithm
SHA256 SHA256 algorithm
MD5 MD5 algorithm