Changes for page 01 Lua Functions

Last modified by Theodore Xu on 2023/10/26 10:51

From version 5.39
edited by Stone Wu
on 2022/07/12 11:15
Change comment: (Autosaved)
To version 5.40
edited by Stone Wu
on 2022/07/12 11:17
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -2038,7 +2038,7 @@
2038 2038  
2039 2039  **Function name**
2040 2040  
2041 -hash_func: use hash algorithm
2041 +hash_func:
2042 2042  
2043 2043  * [md5, sha1, sha224, sha256, sha384, sha512]
2044 2044  * [sha512_224, sha512_256, sha3_224, sha3_256]
... ... @@ -2076,14 +2076,16 @@
2076 2076  
2077 2077  **Function:** SHA calculate
2078 2078  
2079 -**Parameter:**
2079 +**Function name:**
2080 2080  
2081 -hash_func: use hash algorithm
2081 +sha:
2082 2082  
2083 -* [md5, sha1, sha224, sha256, sha384, sha512]
2083 +* sha1, sha224, sha256, sha384, sha512]
2084 2084  * [sha512_224, sha512_256, sha3_224, sha3_256]
2085 2085  * [sha3_384, sha3_512]
2086 2086  
2087 +**Parameter:**
2088 +
2087 2087  key: the key
2088 2088  
2089 2089  message: message content
... ... @@ -2093,3 +2093,17 @@
2093 2093  Succeed: string, calculation result
2094 2094  
2095 2095  Failed: nil
2098 +
2099 +For example:
2100 +
2101 +{{code language="LUA"}}
2102 +local sha = require"sha2"
2103 +
2104 +function sha_test.main()
2105 +
2106 +local sha256 = sha.sha256
2107 +
2108 +print(sha256("your message"))
2109 +
2110 +end
2111 +{{/code}}