Ok. Just to end this, here is what is happening with this. Take for
example this piece of java code:
int i = 235;
byte b = (byte)i;
this will assign b a value of -21. Huh? Ok, so in java a byte is an 8
bit value between -128 to 127. So, what (byte) does to an integer is
to check if the valu
"John Machin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> jose isaias cabrera wrote:
> > > the question is, how can I make this java (byte) call in python? so
> that the
> > result would be the right one, "[EMAIL PROTECTED]"
> However some Java code (I can't believe that it was
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 yo
Nick Craig-Wood wrote:
> When I try your code I get this...
...
[clip]
...
> Traceback (most recent call last):
> File "", line 1, in ?
> File "", line 4, in PrepareHash
> TypeError: 'str' object is not callable
> >>>
>
> You cant do byte(int(byte,16)) - byte is a string! So you haven't
> post
jose isaias cabrera wrote:
> > the question is, how can I make this java (byte) call in python? so
that the
> result would be the right one, "[EMAIL PROTECTED]"
>
Let's get this straight: you have 40 hex digits; both your Java code
and your Python code each do 20 iterations, printing the 20 bytes
jose isaias cabrera <[EMAIL PROTECTED]> wrote:
[java output]
> StringLength = 40
> c1 193 -63
> 7c 124 124
> e1 225 -31
> 86 134 -122
> ab 171 -85
> 94 148 -108
> ee 238 -18
> b0 176 -80
> de 222 -34
> 8a 138 -118
> e3 227 -29
> b5 181 -75
> b7 183 -73
> 51 81 81
> a7 167 -89
> c4
Ok, so this,
buffer[0] = (byte)Integer.parseInt(string,16);
in java is, partly, this
buffer[0] = int(string, 16)
in python. But here is my problem. When I call this java subroutine,
byte[] decodeKey(String inString)
{
if (inString == null)
return null;
System.out.println("Strin
thanks everyone...!
- Original Message -
From: "ech0" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Monday, January 31, 2005 7:27 PM
Subject: Re: Java Integer.ParseInt translation to python
buffer[0] = int(string,16) & 0xff
that should work
--
ht
Yes, that's my problem. I don't want to go through the java stuff. :-)
Thanks.
- Original Message -
From: "Bill Mill" <[EMAIL PROTECTED]>
To: "jose isaias cabrera" <[EMAIL PROTECTED]>
Cc:
Sent: Monday, January 31, 2005 7:28 PM
Subject: Re: J
buffer[0] = int(string,16) & 0xff
that should work
--
http://mail.python.org/mailman/listinfo/python-list
Jose,
On Mon, 31 Jan 2005 19:23:35 -0500, jose isaias cabrera
<[EMAIL PROTECTED]> wrote:
>
> Greetings!
>
> I've looked through the internet (not long, though) but I have not been able
> to find a python translation to
>
> buffer[0] = (byte)Integer.parseInt(string,16);
Tell me what this does,
On Mon, 31 Jan 2005 19:23:35 -0500, jose isaias cabrera
<[EMAIL PROTECTED]> wrote:
>
> Greetings!
>
> I've looked through the internet (not long, though) but I have not been able
> to find a python translation to
>
> buffer[0] = (byte)Integer.parseInt(string,16);
>
> Has anyone ported any java
"jose isaias cabrera" <[EMAIL PROTECTED]> writes:
> I've looked through the internet (not long, though) but I have not
> been able to find a python translation to
>
> buffer[0] = (byte)Integer.parseInt(string,16);
>
> Has anyone ported any java programs to python and has translated this?
I think
13 matches
Mail list logo