misc/simulators/hashbasedsig.py: fix minor miscalculation bug.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 25 Feb 2014 16:55:19 +0000 (16:55 +0000)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 25 Feb 2014 16:55:19 +0000 (16:55 +0000)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
misc/simulators/hashbasedsig.py

index ea220ddfc3e18140b7344f8de05208d5bc2b10f6..db0a09d2118009ef902bec282ab8c54cb1ae9668 100644 (file)
@@ -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-1, lg(B))
+            n_L = ceil_div(L_hash, 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)