Java Integer.ParseInt translation to python

jicman jicman at gmail.com
Wed Feb 9 12:56:15 EST 2005


John Machin wrote:
> jose isaias cabrera wrote:
> However some Java code (I can't believe that it was the Java code
that
> you posted) has printed NINE bytes which bear no relation that I can
> see to any of the TWENTY bytes that the posted Java code should have
> stowed in retBuf.

I know what you're saying, John.  That's what is encryptic about this
whole thing.  The [byte] call in front of any variable will turn the
variable value to a "byte".  If you look at the code at the java code
at the beginning,

>>>   byte[] retBuf = new byte[inString.length()/2];

this retBuf is an array of bytes.  Whatever that means in java.  And
yes, that is the right output or result.  Hmmm, maybe an array of bytes
will turn into retBuf[0]+retBuf[0] = the first letter... Hmmmm....

> You claim that "[B at 1616c7" is the right answer -- what is the
question?

Well, how can I get that exact answer from python?

> What is it meant to be? Your routine is called PrepareHash; is it
> possible that you are seeing these 9 bytes _after_ hashing?

Well, now that you say that, it may be that there is a space there.
Hmmmm, let me try that again...

> Funny
> hashing scheme; they usually give 4, 8, 16, etc bytes, but worth an
ask
> ...

yep, you're right...




More information about the Python-list mailing list