diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-03-05 01:55:39 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-03-05 01:55:39 -0800 |
commit | 3596fc3822bb82dfe05a58fdb78220e399175a4d (patch) | |
tree | 2ea3f9698887608355990864cb1b78835868fe9a | |
parent | 32d19be14e22ada479963ba8627452f5f2d89b94 (diff) | |
download | portage-3596fc3822bb82dfe05a58fdb78220e399175a4d.tar.gz portage-3596fc3822bb82dfe05a58fdb78220e399175a4d.tar.bz2 portage-3596fc3822bb82dfe05a58fdb78220e399175a4d.zip |
whirlpool.py: fix WhirlpoolAdd for bug #406407
This file is a python port of Whirlpool.c the reference implementation:
http://www.larc.usp.br/~pbarreto/whirlpool.zip
Comparison of both implementations reveals a difference in loop logic
at the very beginning of the WhirlpoolAdd function, which is fixed now.
-rw-r--r-- | pym/portage/util/whirlpool.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py index 8415e8754..c696f6fc0 100644 --- a/pym/portage/util/whirlpool.py +++ b/pym/portage/util/whirlpool.py @@ -645,7 +645,7 @@ def WhirlpoolAdd(source, sourceBits, ctx): carry = 0 value = sourceBits i = 31 - while i >= 0 and value != 0: + while i >= 0 and (carry != 0 or value != 0): carry += ctx.bitLength[i] + ((value % 0x100000000) & 0xff) ctx.bitLength[i] = carry % 0x100 carry >>= 8 |