mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-08 05:04:21 +08:00
🎁 Sync 2026-10-18 22:41:16
This commit is contained in:
1 parent
3eca35a513
commit
3159b4f938
88 files changed
+5597
-1051
No files matched your search
@@ -270,10 +270,11 @@ end
|
||||
-- 计算字符串 MD5
|
||||
function md5_string(str)
|
||||
if type(str) ~= "string" then return "" end
|
||||
local quoted = "'" .. str:gsub("'", "'\\''") .. "'"
|
||||
local out = sys.exec("printf '%s' " .. quoted .. " | md5sum")
|
||||
if not out then return "" end
|
||||
return out:sub(1, 32)
|
||||
local path = trim(sys.exec("mktemp /tmp/md5.XXXXXX") or "")
|
||||
if path == "" then return "" end
|
||||
local md5 = fs.writefile(path, str) == #str and md5_file(path) or ""
|
||||
fs.unlink(path)
|
||||
return md5
|
||||
end
|
||||
|
||||
--提取URL中的域名和端口(no ip)
|
||||
|
||||
Reference in new issue
Block a user