Peter Elst

Flash Platform Consultant
  • Home
  • About me
  • Articles
  • Downloads
  • Contact me

SHA1 class for PHP4

15 09 2003

I’ve written this SHA1 class in PHP quite a while ago but thought I might just put it up in case anyone’s still interested in using it.

The code was ported from Branden Hall’s SHA1 Secure Hash for Flash MX which in turn was based on a JavaScript implementation. You can download the code here, feel free to drop me a line if you’re using it for a particular project that’s always nice to know!

FYI, people running a PHP release above 4.3 can use the built-in sha1() and sha1_file() functions.

« Team Macromedia volunteer for Flash Flash MX Components Most Wanted »



Actions

Informations

  • Date : 15 September 2003
  • Categories : PHP

6 responses to “SHA1 class for PHP4”

15 09 2003
Owen van Dijk (16:34:44) :

erm…where is the code? or am i missing some hidden link here? :)

15 09 2003
Peter (16:41:01) :

Oops, code should be available now :D

27 10 2003
Blake Matheny (09:18:48) :

Comparing this with the built in version of, there is a bug somewhere in the encoding. Encoding the string ‘aoo_boo_blih.pdf’ gives an equal hash (between sha1 built in and yours), but changing just one character makes it fail. Encoding ‘ioo_boo_blih.pdf’ gives unequal hashes. What’s going on? Thanks.

14 06 2004
Patrick Smallwood (07:59:03) :

Excellent work. We are working with your code to add SHA1 support for older platforms for our game. You will be mentioned in the credits.

Many thanks.

6 11 2005
Patricio Dorantes (20:14:20) :

Weee, I just can not make it work… my server is using php v 4.02, and when i use the class it just give me a blank result :S.
Do you know what I’m doing wrong, if I just copypaste the example to see how it works.

15 11 2005
Patricio Dorantes Jamarne (06:27:46) :

OOk, I found 2 things…
I could not use it as a class but breaking the class part in different functions and modifying some $this->bla bla bla. I made it work…
BUT:…
The BIG bug I found… is that dechex may return 00FA
and this will result for the sha1 as FA… taking a big difference with the sha1 original algoritm, so… I just did another SO SIMPLE function…

function zeroL($str){ #If missing 0’s

if(strlen($str)





Conferences

Flash on the Beach Speaker

Training Partners

multimediacollege

SkillsMatter

Badges

Alltop, confirmation that I kick ass

  • Categories

    • AIR RSS category feed
    • Ajax RSS category feed
    • CSS RSS category feed
    • Eclipse RSS category feed
    • Events RSS category feed
    • Flash RSS category feed
    • Flash Lite RSS category feed
    • Flex RSS category feed
    • Gadgets RSS category feed
    • General RSS category feed
    • JSFL RSS category feed
    • Mac RSS category feed
    • Open Source RSS category feed
    • PHP RSS category feed
    • Podcasts RSS category feed
    • Publications RSS category feed
    • Rants RSS category feed
    • Reviews RSS category feed
    • Thought of the Day RSS category feed
    • Training RSS category feed
    • Twitter RSS category feed
    • Video RSS category feed
  • Resources

    • AndrĂ© Michelle
    • Richard Leggett
    • Serge Jespers
    • Brajeshwar Oinam
    • Josh Tynjala
    • Jonathan Kaye
    • Mario Klingemann
    • Stefan Richter
    • Simon Barber
    • Owen van Dijk
    • Ted Patrick
    • Scott Barnes
    • Peter Hall
    • Abdul Qabiz
    • Veronique Brossier
    • Edwin van Rijkom
    • Jesse Warden
    • Guy Watson
    • Ralf Bokelberg
    • Chafic Kazoun

     
     

    Adobe Community Expert

    See my profile on LinkedIn



    Harz Ferienwohnung Suchmaschinenoptimierung Geschenkideen Harz Ferienwohnung Pagerank Webkatalog Webhosting