Anyone do a speed test on the sha256 function yet?

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Anyone do a speed test on the sha256 function yet?

Post by AGISB »

Did anyone compare the speed of feyd's sha256 function against php5's hash() yet?
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Not yet. I ran other tests which show SHA256 class's is fairly slow in comparison. But honestly its a PHP implementation - perfect for most open source PHP applications which can't rely on a host having mcrypt enabled. It's in the usage criteria, not the speed that the usefulness of feyd's class is apparent...

http://blog.quantum-star.com/index.php? ... Debug.html
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

No need to do a speed test. PHP's will be faster. But mine is fully portable.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Remember: with a Factory class and some indirection, you can swap Feyd's implementation with mcrypt based on it's availability. Ah, the greatness of polymorphism.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

It's probably what should be done in some cases... In many cases it sees limited usage though.
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Post by AGISB »

with php since the latest php release you don't need mycrypt installed anylonger or does it do so by default?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

5.1.2 has the hash pecl library which has a LOT of hashing functions built in.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Until its built in completely - no external library - a pure PHP implementation still has a lot of value, esp. for widely distributed open source projects.
Post Reply