Changes for page 01 Lua Functions

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

From version 5.37
edited by Stone Wu
on 2022/07/12 11:05
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
... ... @@ -1834,7 +1834,7 @@
1834 1834  
1835 1835  Succeed: string: The value of the monitor point before it is written
1836 1836  
1837 -Failed: mil
1837 +Failed: nil
1838 1838  
1839 1839  == **normal_getdata_byname(string name)** ==
1840 1840  
... ... @@ -1850,7 +1850,7 @@
1850 1850  
1851 1851  Succeed: string
1852 1852  
1853 -Failed: mil
1853 +Failed: nil
1854 1854  
1855 1855  = **11 MySQL database operation** =
1856 1856  
... ... @@ -1890,7 +1890,7 @@
1890 1890  
1891 1891  Succeed: status: returns the number of rows affected by SQL statement execution.
1892 1892  
1893 -Failed: mil, errorString
1893 +Failed: nil, errorString
1894 1894  
1895 1895  == **luaMySql.execWithResult(string statement)** ==
1896 1896  
... ... @@ -1904,7 +1904,7 @@
1904 1904  
1905 1905  Succeed: table: returns the result set
1906 1906  
1907 -Failed: mil, errorString
1907 +Failed: nil, errorString
1908 1908  
1909 1909  For example:
1910 1910  
... ... @@ -2030,18 +2030,82 @@
2030 2030  end
2031 2031  {{/code}}
2032 2032  
2033 -= **12 Message ssummary algorithm** =
2033 += **12 Message summary algorithm** =
2034 2034  
2035 2035  == **hmac(string hash_func, string key, string message)** ==
2036 2036  
2037 -**Function:** Execute the given SQL statement returning the result set (check)
2037 +**Function:** HMAC calculate
2038 2038  
2039 +**Function name**
2040 +
2041 +hash_func:
2042 +
2043 +* [md5, sha1, sha224, sha256, sha384, sha512]
2044 +* [sha512_224, sha512_256, sha3_224, sha3_256]
2045 +* [sha3_384, sha3_512]
2046 +
2039 2039  **Parameter:**
2040 2040  
2041 -statement: the given SQL statement
2049 +key: the key
2042 2042  
2051 +message: message content
2052 +
2043 2043  **Return:**
2044 2044  
2045 -Succeed: table: returns the result set
2055 +Succeed: string, calculation result
2046 2046  
2047 -Failed: mil, errorString
2057 +Failed: nil
2058 +
2059 +For example:
2060 +
2061 +{{code language="LUA"}}
2062 +local sha = require"sha2"
2063 +
2064 +function hmac_test.main()
2065 +
2066 +local hmac = sha.hmac
2067 +
2068 +print(hmac(sha.sha1,
2069 +
2070 +"your key", "your message"))
2071 +
2072 +end
2073 +{{/code}}
2074 +
2075 +== **sha(string message** ==
2076 +
2077 +**Function:** SHA calculate
2078 +
2079 +**Function name:**
2080 +
2081 +sha:
2082 +
2083 +* sha1, sha224, sha256, sha384, sha512]
2084 +* [sha512_224, sha512_256, sha3_224, sha3_256]
2085 +* [sha3_384, sha3_512]
2086 +
2087 +**Parameter:**
2088 +
2089 +key: the key
2090 +
2091 +message: message content
2092 +
2093 +**Return:**
2094 +
2095 +Succeed: string, calculation result
2096 +
2097 +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}}