Page 1 of 1

sha256 check -- default to MD5

Posted: Sat Oct 11, 2008 3:40 pm
by alex.barylski
I have this incredibly complex function:

Code: Select all

    
function calc_hash($value)
{
    if(function_exists('hash')){
        return hash('sha256', $value);
    }
 
    return md5($value);
}
Is this enough to ensure the right function is called? Is there a way to check if sha256 is installed as a extension or does it alwasy come with the hash() familiy?

Re: sha256 check -- default to MD5

Posted: Sat Oct 11, 2008 7:40 pm
by aaronhall

Re: sha256 check -- default to MD5

Posted: Sun Oct 12, 2008 11:23 am
by alex.barylski
Perfect. :)

Thank you :)