Issue1599004
Created on 2006-11-18.22:22:22 by akuchling, last changed 2006-12-31.21:29:44 by cgroves.
File name |
Uploaded |
Description |
Edit |
Remove |
sha.patch
|
akuchling,
2006-11-18.22:22:22
|
First draft of MD5/SHA fixes |
|
|
sha.patch
|
akuchling,
2006-11-19.18:45:05
|
Revised patch against trunk |
|
|
msg1272 (view) |
Author: A.M. Kuchling (akuchling) |
Date: 2006-11-18.22:22:22 |
|
test_hmac and test_pep247 fail because of problems with the SHA module.
* SHA and MD5 objects lack a .digest_size attribute.
* Successive calls to digest() return different values.
* For digest(), the byte array is converted to a string using the default encoding, which produces weird results if it's UTF-8. It should hardwire using ISO-8859-1, because we want a 1-to-1 mapping of characters.
The attached patch fixes test_pep247. test_hmac still fails; I'm still looking into the problem.
|
msg1273 (view) |
Author: A.M. Kuchling (akuchling) |
Date: 2006-11-19.18:45:05 |
|
Revised version of the patch against the trunk; this now fixes test_hmac. The problem was the use of .getBytes(), which uses a system-specific encoding; here we need it to use ISO-8859-1.
|
msg1274 (view) |
Author: Charlie Groves (cgroves) |
Date: 2006-11-20.19:37:40 |
|
I only see one problem in these changes: calling String.getBytes with ISO-8859-1 uses CodingErrorAction.REPLACE in its internal CharsetEncoder. That just replaces characters above 255 with '?'. I think we want it to throw an exception, right?
Unfortunately, CharsetEncoder appeared in Java 1.4 so we can't just use it directly for 2.2. As far as I can tell, there's no way in versions earlier than 1.4 to get that kind of control over the encoding in Java's library. We may have to write a bit of code in PyString or the like that handles converting Strings to bytes and reports errors instead of eating them. This applies to http://jython.org/bugs/1599900 as well.
|
msg1275 (view) |
Author: Charlie Groves (cgroves) |
Date: 2006-12-31.21:29:44 |
|
Committed in r3038.
|
|
Date |
User |
Action |
Args |
2006-11-18 22:22:22 | akuchling | create | |
|