Ballerina API Documentation

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 NameData TypeDescription
baseStringstringThe string to be hashed
algorithmAlgorithmThe hashing algorithm to be used

Return Parameters:

Return VariableData TypeDescription
stringThe hashed string

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

Returns the HMAC value of the provided base string.

Parameters:

Parameter NameData TypeDescription
baseStringstringThe string to be hashed
keyStringstringThe key string
algorithmAlgorithmThe hashing algorithm to be used

Return Parameters:

Return VariableData TypeDescription
stringThe hashed string


Menu

  • Enums
    • Algorithm
  • Functions
    • getHash(string baseString, Algorithm algorithm) (string )
    • getHmac(string baseString, string keyString, Algorithm algorithm) (string )

Copyright 2017 Ballerina API Documentation