Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

SHA-1 problem

by mattaustin (Initiate)
on Jun 23, 2005 at 17:50 UTC ( #469473=perlquestion: print w/replies, xml ) Need Help??

mattaustin has asked for the wisdom of the Perl Monks concerning the following question:

My problem is very similar to this problem. I am working on the new authentication for the yahoo Perl module, but I'm stuck on a part that requires the sha module to do some weird things:
the C code:
shaUpdate(&ctx1, crypt_hash_xor1, 64); /* Start of additions */ if(j>=3) ctx1.sizeLo = 0x1ff; /* End of additions */ shaUpdate(&ctx1, magic_key_char, 4); shaFinal(&ctx1, digest1);
My problem is the same as the other post in java. I don't see it possible with the current Digest::SHA module to change the sizeLo before I make the digest. My first part of the question is it possible with and current modules?

I am assuming its i decided to port over from the c code and from a python class, both unsuccessful.

c code:

my try:

python code:

my try:

The c conversion gives me a bit shift error, and the python just wrong?

Thanks in advance Great Ones!

Replies are listed 'Best First'.
Re: SHA-1 problem
by !1 (Hermit) on Jun 23, 2005 at 21:21 UTC
    I don't see any way of doing this easily with Digest::SHA beyond changing the source and recompiling it. Of course, if that seems a bit difficult you could always take the source of Digest::SHA::PurePerl and modify it in the ways that you need.
      I have looked at that module and it just looked like it had way too much that I didn't need. Anyone see anything wrong with either one of my conversions? I fell that there really close, just some simple over looked error.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://469473]
Approved by moot
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2021-09-26 21:58 GMT
Find Nodes?
    Voting Booth?

    No recent polls found