# HG changeset patch # User Matthew Wild # Date 1282401073 -3600 # Node ID 0f2446a9f65f5a050dcc9a7cdf38943e5ce2d5d4 # Parent 58305b983b1a25ee75eb6e1030fd5af57a73ab18 util.sha1: Obey second parameter which decides whether to return the result in ASCII hex encoding diff -r 58305b983b1a -r 0f2446a9f65f util/sha1.lua --- 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)