Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/
Date: Mon, 05 Mar 2012 09:56:08
Message-Id: 1330941339.3596fc3822bb82dfe05a58fdb78220e399175a4d.zmedico@gentoo
1 commit: 3596fc3822bb82dfe05a58fdb78220e399175a4d
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Mar 5 09:55:39 2012 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 5 09:55:39 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3596fc38
7
8 whirlpool.py: fix WhirlpoolAdd for bug #406407
9
10 This file is a python port of Whirlpool.c the reference implementation:
11
12 http://www.larc.usp.br/~pbarreto/whirlpool.zip
13
14 Comparison of both implementations reveals a difference in loop logic
15 at the very beginning of the WhirlpoolAdd function, which is fixed now.
16
17 ---
18 pym/portage/util/whirlpool.py | 2 +-
19 1 files changed, 1 insertions(+), 1 deletions(-)
20
21 diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py
22 index 8415e87..c696f6f 100644
23 --- a/pym/portage/util/whirlpool.py
24 +++ b/pym/portage/util/whirlpool.py
25 @@ -645,7 +645,7 @@ def WhirlpoolAdd(source, sourceBits, ctx):
26 carry = 0
27 value = sourceBits
28 i = 31
29 - while i >= 0 and value != 0:
30 + while i >= 0 and (carry != 0 or value != 0):
31 carry += ctx.bitLength[i] + ((value % 0x100000000) & 0xff)
32 ctx.bitLength[i] = carry % 0x100
33 carry >>= 8