Module for hashing and encoding operations

Types

This module does not provide any types.

Properties

This module has no properties.

Methods

hs.hash.base64Encode

Encode a string to base64


Declaration

hs.hash.base64Encode(data) -> string

Parameters

  • data string

    The string to encode

Return Value

Base64 encoded string

hs.hash.base64Decode

Decode a base64 string


Declaration

hs.hash.base64Decode(data) -> string

Parameters

  • data string

    The base64 string to decode

Return Value

Decoded string, or nil if the input is invalid

hs.hash.md5

Generate MD5 hash of a string


Declaration

hs.hash.md5(data) -> string

Parameters

  • data string

    The string to hash

Return Value

Hexadecimal MD5 hash

hs.hash.sha1

Generate SHA1 hash of a string


Declaration

hs.hash.sha1(data) -> string

Parameters

  • data string

    The string to hash

Return Value

Hexadecimal SHA1 hash

hs.hash.sha256

Generate SHA256 hash of a string


Declaration

hs.hash.sha256(data) -> string

Parameters

  • data string

    The string to hash

Return Value

Hexadecimal SHA256 hash

hs.hash.sha512

Generate SHA512 hash of a string


Declaration

hs.hash.sha512(data) -> string

Parameters

  • data string

    The string to hash

Return Value

Hexadecimal SHA512 hash

hs.hash.hmacMD5

Generate HMAC-MD5 of a string with a key


Declaration

hs.hash.hmacMD5(key, data) -> string

Parameters

  • key string

    The secret key

  • data string

    The data to authenticate

Return Value

Hexadecimal HMAC-MD5

hs.hash.hmacSHA1

Generate HMAC-SHA1 of a string with a key


Declaration

hs.hash.hmacSHA1(key, data) -> string

Parameters

  • key string

    The secret key

  • data string

    The data to authenticate

Return Value

Hexadecimal HMAC-SHA1

hs.hash.hmacSHA256

Generate HMAC-SHA256 of a string with a key


Declaration

hs.hash.hmacSHA256(key, data) -> string

Parameters

  • key string

    The secret key

  • data string

    The data to authenticate

Return Value

Hexadecimal HMAC-SHA256

hs.hash.hmacSHA512

Generate HMAC-SHA512 of a string with a key


Declaration

hs.hash.hmacSHA512(key, data) -> string

Parameters

  • key string

    The secret key

  • data string

    The data to authenticate

Return Value

Hexadecimal HMAC-SHA512