From 3a37b7c5b5d7b70777c67180279f557fd70b52f4 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 4 Oct 2011 17:59:30 -0700 Subject: [PATCH] whirlpool.py: fix for python3 --- pym/portage/util/whirlpool.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pym/portage/util/whirlpool.py b/pym/portage/util/whirlpool.py index 399958a1f..c5c2b3765 100644 --- a/pym/portage/util/whirlpool.py +++ b/pym/portage/util/whirlpool.py @@ -639,7 +639,8 @@ def WhirlpoolInit(ctx): return def WhirlpoolAdd(source, sourceBits, ctx): - source = [ord(s)&0xff for s in source] + if sys.hexversion < 0x3000000: + source = [ord(s)&0xff for s in source] carry = 0 value = sourceBits @@ -785,9 +786,9 @@ def processBuffer(ctx): # if __name__ == '__main__': - assert Whirlpool('The quick brown fox jumps over the lazy dog').hexdigest() == \ + assert Whirlpool(b'The quick brown fox jumps over the lazy dog').hexdigest() == \ 'b97de512e91e3828b40d2b0fdce9ceb3c4a71f9bea8d88e75c4fa854df36725fd2b52eb6544edcacd6f8beddfea403cb55ae31f03ad62a5ef54e42ee82c3fb35' - assert Whirlpool('The quick brown fox jumps over the lazy eog').hexdigest() == \ + assert Whirlpool(b'The quick brown fox jumps over the lazy eog').hexdigest() == \ 'c27ba124205f72e6847f3e19834f925cc666d0974167af915bb462420ed40cc50900d85a1f923219d832357750492d5c143011a76988344c2635e69d06f2d38c' - assert Whirlpool('').hexdigest() == \ + assert Whirlpool(b'').hexdigest() == \ '19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3' -- 2.26.2