this is most interesting.  The real test for me is going to be whether or not the digest created in jython and stashed is going to be == to one created by python.  We may be using md5 to test whether data has changed, and it needs to work in both environments.  I somewhat suspect that it might given your comments here.

Kent Johnson <> wrote:
Leo User wrote:
> Hi,
> I noticed some capitalisation differences in the output from md5 in
> jython and python. I don't know if its broken, but Im assuming that it is.
> A Jython session:
> Jython 2.2a1 on java1.5.0_02 (JIT: null)
> >>> a.digest()
> '\xC0\x1A\xE1\xA5\xF1"\xF2\\\xE5g_\x86\x02\x8BSj'
> >>>
> A Python session:
> C:\WINDOWS>python
> Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on
> win32
> >>> a.digest()
> '\xc0\x1a\xe1\xa5\xf1"\xf2\\\xe5g_\x86\x02\x8bSj'
> >>>
> --------
> notice how the digest returns the same letters but in some cases the
> capitalisation is different.

This is just a difference in the repr() of the string - the letters are hex digits in \x escapes, not actually part of the hash itself. A plain string shows the same difference:
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> '\xab'
>>> ^Z

Jython 2.2a1 on java1.4.2_06 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> '\xab'

Arguably this is a bug in str.__repr__() but it is not a problem with the hash algorithm.


SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play:
Jython-dev mailing list

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around