http://zorba.io/modules/hash

View as XML or JSON.

This module provides functions that perform different hash operations. For example, they compute MD5 and various SHA functions on either strings or binary. The result is the base64 encoded value of the hash.

Function Summary

hash-binary ($value as xs:base64Binary, $alg as xs:string) as xs:base64Binary external

This function computes a hash value of the binary form of the given base64Binary item, i.

hash ($value as xs:string, $alg as xs:string) as xs:base64Binary external

This function computes a hash value of the string provided as parameter.

md5-binary ($value as xs:base64Binary) as xs:base64Binary

This function computes the MD5 hash value of the binary form of the given base64Binary item, i.

md5 ($value as xs:string) as xs:base64Binary

Computes the MD5 hash of the string provided as parameter.

sha1-binary ($value as xs:base64Binary) as xs:base64Binary

This function computes the SHA1 hash value of the binary form of the given base64Binary item, i.

sha1 ($value as xs:string) as xs:base64Binary

Computes the SHA1 hash of the string provided as parameter.

Functions

hash-binary#2

declare  function hash:hash-binary($value as xs:base64Binary, $alg as xs:string) as xs:base64Binary external
This function computes a hash value of the binary form of the given base64Binary item, i.e. the item is base64-decoded before hashing.

Parameters

value as xs:base64Binary
The binary item to be hashed.
alg as xs:string
The algorithm to use for this hashing operation. Supported algorithms are "md5", "sha1", and "sha256".

Returns

xs:base64Binary
The hash as xs:base64Binary of the provided binary

hash#2

declare  function hash:hash($value as xs:string, $alg as xs:string) as xs:base64Binary external
This function computes a hash value of the string provided as parameter. The function expects the hash algorithm to be used as parameter.

Parameters

value as xs:string
The string to be hashed.
alg as xs:string
The algorithm to use for this hashing operation. Supported algorithms are "md5", "sha1", and "sha256".

Returns

xs:base64Binary
The hash as xs:base64binary of the provided string

md5-binary#1

declare  function hash:md5-binary($value as xs:base64Binary) as xs:base64Binary
This function computes the MD5 hash value of the binary form of the given base64Binary item, i.e. the item is base64-decoded before hashing.

Parameters

value as xs:base64Binary
The binary item to hash.

Returns

xs:base64Binary
The MD5 hash of the provided binary.

md5#1

declare  function hash:md5($value as xs:string) as xs:base64Binary
Computes the MD5 hash of the string provided as parameter.

Parameters

value as xs:string
The string to hash

Returns

xs:base64Binary
The MD5 hash as xs:base64Binary

sha1-binary#1

declare  function hash:sha1-binary($value as xs:base64Binary) as xs:base64Binary
This function computes the SHA1 hash value of the binary form of the given base64Binary item, i.e. the item is base64-decoded before hashing.

Parameters

value as xs:base64Binary
The binary item to hash.

Returns

xs:base64Binary
The base64 encoded SHA1 hash of the provided binary.

sha1#1

declare  function hash:sha1($value as xs:string) as xs:base64Binary
Computes the SHA1 hash of the string provided as parameter.

Parameters

value as xs:string
The string to hash.

Returns

xs:base64Binary
The SHA1 hash as xs:base64Binary