# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1452603980 -3600
# Node ID b4ce2e524ed8dad11c35670407a773d0795d3e7b
# Parent  918829f384d6b707eea5dab2d9a2d213be07b364
libs.hashes: Fix HMAC-SHA-1 blocksize to 64 (20 is output size)

diff -r 918829f384d6 -r b4ce2e524ed8 libs/hashes.lua
--- a/libs/hashes.lua	Sat Jan 09 02:03:26 2016 +0100
+++ b/libs/hashes.lua	Tue Jan 12 14:06:20 2016 +0100
@@ -35,13 +35,13 @@
 	local t_concat = table.concat;
 
 	local function hmac_sha1(key, message, hexres)
-		if #key > 20 then
+		if #key > 64 then
 			key = sha1(key);
-		elseif #key < 20 then
-			key = key .. s_rep("\0", 20 - #key);
+		elseif #key < 64 then
+			key = key .. s_rep("\0", 64 - #key);
 		end
 		local o_key_pad, i_key_pad = {}, {}
-		for i = 1, 20 do
+		for i = 1, 64 do
 			local b = s_byte(key, i)
 			o_key_pad[i] = s_char(bxor(b, 0x5c));
 			i_key_pad[i] = s_char(bxor(b, 0x36));