Changeset

6786:3deeb38d79ab

util.sasl.scram: Get rid of module call
author Kim Alvefur <zash@zash.se>
date Tue, 07 Apr 2015 23:26:32 +0200
parents 6785:bf1f09a5bcf7
children 6787:ad64e2eacd0e
files util/sasl/scram.lua
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/util/sasl/scram.lua	Fri Mar 13 21:11:33 2015 +0100
+++ b/util/sasl/scram.lua	Tue Apr 07 23:26:32 2015 +0200
@@ -25,7 +25,7 @@
 local char = string.char;
 local byte = string.byte;
 
-module "sasl.scram"
+local _ENV = nil;
 
 --=========================
 --SASL SCRAM-SHA-1 according to RFC 5802
@@ -87,7 +87,7 @@
 	return hashname:lower():gsub("-", "_");
 end
 
-function getAuthenticationDatabaseSHA1(password, salt, iteration_count)
+local function getAuthenticationDatabaseSHA1(password, salt, iteration_count)
 	if type(password) ~= "string" or type(salt) ~= "string" or type(iteration_count) ~= "number" then
 		return false, "inappropriate argument types"
 	end
@@ -235,7 +235,7 @@
 	return scram_hash;
 end
 
-function init(registerMechanism)
+local function init(registerMechanism)
 	local function registerSCRAMMechanism(hash_name, hash, hmac_hash)
 		registerMechanism("SCRAM-"..hash_name, {"plain", "scram_"..(hashprep(hash_name))}, scram_gen(hash_name:lower(), hash, hmac_hash));
 
@@ -246,4 +246,7 @@
 	registerSCRAMMechanism("SHA-1", sha1, hmac_sha1);
 end
 
-return _M;
+return {
+	getAuthenticationDatabaseSHA1 = getAuthenticationDatabaseSHA1;
+	init = init;
+}