Module jls.util.MessageDigest

Provide message digest algorithm functionality.

Available algorithms are SHA-1, MD5, CRC32.

Class MessageDigest

messageDigest:update (m) Updates the digest using the specified string.
messageDigest:digest () Completes and returns the digest.
messageDigest:reset () Resets this MessageDigest.
messageDigest:getAlgorithm () Returns the name of the algorithm.
MessageDigest.getMessageDigest (alg) Returns the MessageDigest corresponding to the specified algorithm.
MessageDigest.getInstance (alg) Creates a new MessageDigest.


Class MessageDigest

The MessageDigest class. The MessageDigest class provides access to algorithms that compute message digest or hash from any string or message.
messageDigest:update (m)
Updates the digest using the specified string.

Parameters:

  • m string a message to update the digest

Returns:

    MessageDigest this message digest instance
messageDigest:digest ()
Completes and returns the digest.

Returns:

    string the message digest result
messageDigest:reset ()
Resets this MessageDigest.

Returns:

    MessageDigest this message digest instance
messageDigest:getAlgorithm ()
Returns the name of the algorithm.

Returns:

    string the name of the algorithm
MessageDigest.getMessageDigest (alg)
Returns the MessageDigest corresponding to the specified algorithm.

Parameters:

  • alg string The name of the algorithm

Returns:

    The MessageDigest class
MessageDigest.getInstance (alg)
Creates a new MessageDigest.

Parameters:

  • alg string The name of the algorithm

Returns:

    MessageDigest a new MessageDigest

Usage:

    local md = MessageDigest.getInstance('MD5')
    md:update('The quick brown fox jumps over the lazy dog'):digest()
generated by LDoc 1.4.6