Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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 not..so i decided to port over from the c code and from a python class, both unsuccessful.

c code:
http://www.openaether.org/jabberd2/source/util/sha1.c

my try:
http://www.msndev.com/source/sha/sha1-2.pm

python code:
http://www.msndev.com/source/sha/shatest.py

my try:
http://www.msndev.com/source/sha/SHA.pm

The c conversion gives me a bit shift error, and the python convert...is 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2021-09-26 21:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?