You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/scripts/builtin-modules/hash.md
+2-12Lines changed: 2 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,6 @@ hash.md5(input: <string|bytes>)
25
25
::: warning Important Notes
26
26
-**String parameter is only for file paths**: If a string is passed, the function will calculate the hash value of that file
27
27
-**Binary data must use bytes parameter**: To calculate the hash value of binary data, you must wrap the data with the `bytes()` function
28
-
-**String data hashing**: To calculate the hash value of string data, please use `hash.strhash32`, `hash.strhash64`, or `hash.strhash128` interfaces
29
28
-**Common mistake**: If the file doesn't exist, the function will incorrectly treat the file path as string data to calculate the hash value, and it won't report an error, resulting in incorrect results
30
29
:::
31
30
@@ -58,9 +57,7 @@ print("MD5: " .. checksum)
58
57
-- ❌ Wrong: If "hello" is not a file path, it will incorrectly calculate the hash of the file path string
59
58
localchecksum=hash.md5("hello")
60
59
61
-
-- ✅ Correct: Use strhash interface to calculate string hash value
0 commit comments