summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Scribunto/includes/engines/LuaCommon/lualib/mw.hash.lua
blob: 95026e3381fece2c242c54227533f95cfe0be70a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local hash = {}
local php

local util = require 'libraryUtil'
local checkType = util.checkType

function hash.listAlgorithms()
	return php.listAlgorithms()
end

function hash.hashValue( algo, value )
	checkType( 'hashValue', 1, algo, 'string' )
	checkType( 'hashValue', 2, value, 'string' )

	return php.hashValue( algo, value )
end

function hash.setupInterface()
	-- Boilerplate
	php = mw_interface
	mw_interface = nil

	-- Register this library in the "mw" global
	mw = mw or {}
	mw.hash = hash

	package.loaded['mw.hash'] = hash
end

return hash