util.sha1: Obey second parameter which decides whether to return the result in ASCII hex encoding

Sat, 21 Aug 2010 15:31:13 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 21 Aug 2010 15:31:13 +0100
changeset 105
0f2446a9f65f
parent 104
58305b983b1a
child 106
7d293830f4a4

util.sha1: Obey second parameter which decides whether to return the result in ASCII hex encoding

util/sha1.lua file | annotate | diff | comparison | revisions
--- a/util/sha1.lua	Sat Aug 21 15:30:40 2010 +0100
+++ b/util/sha1.lua	Sat Aug 21 15:31:13 2010 +0100
@@ -119,7 +119,7 @@
 
 -------------------------------------------------
 
-local function sha1(str, hex)
+local function sha1(str, hexres)
 	str = PreProcess(str)
 	h0  = 1732584193
 	h1  = 4023233417
@@ -129,7 +129,7 @@
 	MainLoop(str)
 	local hex = ToHex(h0)..ToHex(h1)..ToHex(h2)
 	            ..ToHex(h3)..ToHex(h4);
-	if hex then
+	if hexres then
 		return  hex;
 	else
 		return hex:gsub("..", function (byte)

mercurial