turbo.hash – Cryptographic Hashes

Wrappers for the OpenSSL crypto library.

SHA1 class


Create a SHA1 object. Pass a Lua string with the initializer to digest it.

Parameters:str (String or nil) – Lua string to digest immediately. Note that you cannot call SHA1.update or SHA1.final afterwards as the digest is already final.

Update SHA1 context with more data

Parameters:str – String

Finalize SHA1 context

Return type:(char*) Message digest.

Compare two SHA1 contexts with the equality operator ==.

Return type:(Boolean) True or false.

Convert message digest to Lua hex string.

Return type:String
HMAC(key, digest)

Keyed-hash message authentication code (HMAC) is a specific construction for calculating a message authentication code (MAC) involving a cryptographic hash function in combination with a secret cryptographic key.

  • key (String) – Sequence of bytes used as a key.
  • digest (String) – String to digest.
Return type:

String. Hex representation of digested string.