webmcp

diff libraries/moonhash/moonhash.autodoc.lua @ 506:83b3882dc31b

New functions moonhash.shake128(data, len, alphabet), moonhash.shake256(data, len, alphabet)
Removed moonhash.shake128_128(...)
author jbe
date Wed Aug 16 00:31:11 2017 +0200 (2017-08-16)
parents b36e366bba2b
children
line diff
     1.1 --- a/libraries/moonhash/moonhash.autodoc.lua	Tue Aug 15 21:00:51 2017 +0200
     1.2 +++ b/libraries/moonhash/moonhash.autodoc.lua	Wed Aug 16 00:31:11 2017 +0200
     1.3 @@ -51,15 +51,31 @@
     1.4  
     1.5  
     1.6  --[[--
     1.7 -hash =              -- 128 bits of SHAKE128 digest (in hex notation) of input string
     1.8 -moonhash.shake128_128(
     1.9 -  data              -- input string
    1.10 +hash =              -- SHAKE128 digest of input string
    1.11 +moonhash.shake128(
    1.12 +  input_data,       -- input string
    1.13 +  output_length,    -- number of characters (not bytes or bits) in output, defaults to 32
    1.14 +  output_alphabet   -- characters for encoding, defaults to "0123456789abcdef" for hex encoding
    1.15  )
    1.16  
    1.17 -Calculates the first 128 bits of the SHAKE128 digest (FIPS 202) with a security of 64 bits for collision attacks and 128 bits for preimage and second preimage attacks.
    1.18 +Calculates a SHAKE128 digest (FIPS 202) with a security of math.min(128, math.log(#output_alphabet, 2) * output_length/2) for collision attacks and math.min(128, math.log(#output_alphabet, 2) * output_length) for preimage and second preimage attacks. If #output_alphabet is a power of 2, a direct base-N encoding is performed. Otherwise, a base-N encoding with N equal to the next higher power of 2 is performed, and all character values smaller than or equal to #output_alphabet are discarded from the stream (the process is repeated until the hash length reaches the required output_length).
    1.19  
    1.20  --]]--
    1.21  -- Implemented in moonhash.c and moonhash_sha3.c
    1.22  --//--
    1.23  
    1.24  
    1.25 +--[[--
    1.26 +hash =              -- SHAKE256 digest of input string
    1.27 +moonhash.shake256(
    1.28 +  input_data,       -- input string
    1.29 +  output_length,    -- number of characters (not bytes or bits) in output, defaults to 64
    1.30 +  output_alphabet   -- characters for encoding, defaults to "0123456789abcdef" for hex encoding
    1.31 +)
    1.32 +
    1.33 +Calculates a SHAKE256 digest (FIPS 202) with a security of math.min(256, math.log(#output_alphabet, 2) * output_length/2) for collision attacks and math.min(256, math.log(#output_alphabet, 2) * output_length) for preimage and second preimage attacks. If #output_alphabet is a power of 2, a direct base-N encoding is performed. Otherwise, a base-N encoding with N equal to the next higher power of 2 is performed, and all character values smaller than or equal to #output_alphabet are discarded from the stream (the process is repeated until the hash length reaches the required output_length).
    1.34 +
    1.35 +--]]--
    1.36 +-- Implemented in moonhash.c and moonhash_sha3.c
    1.37 +--//--
    1.38 +

Impressum / About Us