Module:Hash function

From Eurovision Wiki
Revision as of 11:47, 28 December 2025 by imported>Gonnym (do this correctly)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Hash function/doc

require("strict")

local p = {}

function p.main(frame)
	local algo = frame.args['algo'] or frame.args[1]
	local value = frame.args['value'] or frame.args[2]
	return mw.hash.hashValue( algo, value )
end

function p.list()
	local list = {}
	for i, v in ipairs(mw.hash.listAlgorithms()) do
		list[i] = "<code>" .. v .. "</code>"
	end
	
	return table.concat(list, ",\n")
end

return p