From 37199782153f8ff0f74d86c35d18cfd59d2a6dfa Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Tue, 25 Feb 2014 16:57:57 +0000
Subject: [PATCH] misc/simulators/hashbasedsig.py: revert last patch; the
 original code was correct.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 misc/simulators/hashbasedsig.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/simulators/hashbasedsig.py b/misc/simulators/hashbasedsig.py
index db0a09d2..ea220ddf 100644
--- a/misc/simulators/hashbasedsig.py
+++ b/misc/simulators/hashbasedsig.py
@@ -164,7 +164,7 @@ def calculate(K, K1, K2, q_max, L_hash, trees):
             # n is the number of digits needed to sign the message representative and checksum.
             # The representation is base-B, except that we allow the most significant digit
             # to be up to 2B-1.
-            n_L = ceil_div(L_hash, lg(B))
+            n_L = ceil_div(L_hash-1, lg(B))
             firstL_max = floor_div(pow(2, L_hash)-1, pow(B, n_L-1))
             C_max = firstL_max + (n_L-1)*(B-1)
             n_C = ceil_log(ceil_div(C_max, 2), B)
-- 
2.45.2