[pycrypto] Initial review of Thorsten's Py3k changes

Legrandin gooksankoo at hoiptorrow.mailexpire.com
Wed Jan 19 04:26:06 CST 2011


I am not sure if I grasp all new stuff in Python 3, but would it possible to
keep the test vectors as they are, and possibly change the encoding at runtime?

For instance, in test_AES.py, we have:

test_data = [
...
( '00112233445566778899aabbccddeeff', 'dda97ca4864cdfe06eaf70a0ec0d7191',
  '000102030405060708090a0b0c0d0e0f1011121314151617',
  'FIPS 197 C.2 (AES-192)' ),
... ]

The proposed change wraps each string but the last one with b().

Instead of changing the test vector line, we could have a separate
piece of code that dynamically
adjusts a tuple in the list in case python 3 is detected.

Something along these lines, but possibly more pythonic:

if python_version>2:
   for t in test_data:
     idx = test_data.index(t)
     newt = tuple(b(t[0), b(t[1]), b(t[2]), t[3])
     test_data[idx] = newt


2011/1/11 Thorsten Behrens <sbehrens at gmx.li>:
> Dwayne,
>
> upon further thought, how would the following work for you to address
> your concerns:
>
> - b('something') vs 'something': Leave literals encased in b(). To
> assure that no malicious changes have been made, use a 30-day trial
> version of Beyond Compare 3, which will, in it's "Text Compare"
> function, highlight the exact changes on each line. It exists for Linux
> and Windows. vimdiff may work just as well, of course.
> http://www.scootersoftware.com/download.php
>
> - Multiple commits, too much "history of work", not enough "this is the
> change": Would you like me to create a py3kmk2 branch, and have a single
> commit in it with all the changes made?
>   I don't think I am going to be very successful with rebase.
>
> Yours
> Thorsten
>
> _______________________________________________
> pycrypto mailing list
> pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>


More information about the pycrypto mailing list