Software /
code /
verse
Diff
util/sha1.lua @ 105:0f2446a9f65f
util.sha1: Obey second parameter which decides whether to return the result in ASCII hex encoding
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 21 Aug 2010 15:31:13 +0100 |
parent | 57:8e8bac82e119 |
child | 111:75c73ac9d5a6 |
line wrap: on
line diff
--- 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)