Modul:Hash
Bu modul uchun Modul:Hash/doc nomli hujjat sahifasini yaratishingiz mumkin
local getArgs = require('Module:Arguments').getArgs
local p = {}
local function inTable(table, value)
for k, v in pairs(table) do
if v == value then
return true
end
end
return false
end
function p.list(frame)
return table.concat(mw.hash.listAlgorithms(), '; ')
end
function p.main(frame)
local args = getArgs(frame, { frameOnly = true })
local algorithm
if not args[1] then
return
end
if args[2] then
if not inTable(mw.hash.listAlgorithms(), args[2]) then
return args[2]
end
algorithm = args[2]
else
algorithm = 'fnv164'
end
return mw.hash.hashValue(algorithm, args[1])
end
return p