Enums of ballerina.security.crypto package
public enum Algorithm
The algorithms which can be used in crypto functions.
Enumerators:
Name | Description |
---|---|
SHA1 | SHA1 algorithm |
SHA256 | SHA256 algorithm |
MD5 | MD5 algorithm |
Functions of ballerina.security.crypto package
public function getHash(string baseString, Algorithm algorithm) (string)
Returns the hash of the given string using the specified algorithm.
Parameters:
Parameter Name | Data Type | Description |
---|---|---|
baseString | string | The string to be hashed |
algorithm | Algorithm | The hashing algorithm to be used |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The hashed string |
public function getHmac(string baseString, string keyString, Algorithm algorithm) (string)
Returns the HMAC value of the provided base string.
Parameters:
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 |
Return Parameters:
Return Variable | Data Type | Description |
---|---|---|
string | The hashed string |