Secure Hashing Approved Algorithms – How do I perform SHA-2 family hashing in my PHP application?

1 Comment

secuirtyshield.jpgThere are five Approved algorithms for generating a condensed representation of a message (message digest): SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512.

The SHA-2 family of hash functions (i.e., SHA-224, SHA-256, SHA-384 and SHA-512) may be used by Federal agencies for all applications using secure hash algorithms. Federal agencies should stop using SHA-1 for digital signatures, digital time stamping and other applications that require collision resistance as soon as practical, and must use the SHA-2 family of hash functions for these applications after 2010. After 2010, Federal agencies may use SHA-1 only for the following applications: hash-based message authentication codes (HMACs); key derivation functions (KDFs); and random number generators (RNGs).

With PHP >= 5.1.2, You can use hash() to generate a hash value, hash_algos() will return an array of supported hashing algorithms. See:Upgrade to PHP >= 5.1.2. You can use hash() to generate a hash value, hash_algos() will return an array of supported hashing algorithms. Following code produces hash results.

Click here to Test hashgen

SHA-1 was compromised by a research team in China and it’s use has been discontinued by the U.S Government in favor of the SHA-2 family of hashing algorithms.

syntax:
string hash ( string $algo , string $data [, bool $raw_output= false ] )

[code lang="php"]
echo hash('md5', 'The quick brown fox jumped over the lazy dog.') . "
\n";
echo hash('sha1', 'The quick brown fox jumped over the lazy dog.') . "
\n";
echo hash('sha256', 'The quick brown fox jumped over the lazy dog.') . "
\n";
echo hash('sha384', 'The quick brown fox jumped over the lazy dog.') . "
\n";
echo hash('sha512', 'The quick brown fox jumped over the lazy dog.') . "
\n";
?>
[/code]

echo hash('md5', 'The quick brown fox jumped over the lazy dog.') . "
\n”;
echo hash(‘sha1′, ‘The quick brown fox jumped over the lazy dog.’) . “
\n”;
echo hash(‘sha256′, ‘The quick brown fox jumped over the lazy dog.’) . “
\n”;
echo hash(‘sha384′, ‘The quick brown fox jumped over the lazy dog.’) . “
\n”;
echo hash(‘sha512′, ‘The quick brown fox jumped over the lazy dog.’) . “
\n”;
?>

Ref:
http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html
http://www.schneier.com/blog/archives/2005/02/sha1_broken.html

Following Google Searches Lead To This Post: sha2 java
java sha2-256 sampl
java sha2-256 base64 sample
java sha-256 base64 sample
java how to hash sha-256
sha2 in oracle
linux sha hash
oracel sha 256
java sha-2
unix password hash java
sha-2 sql
“get hash” “shell script” unix
java sha2
php SHA2
pl sql one way hash SHA512
java encryption sha2 examples
secure hash algorithm sha 1 IN ORACLE
secure 512 php encryption
Linux password hash sha256
SHA hasing algorithm the highest
java sha2 example
SHA hashing algorithm the highest
sha-2 generate
php hash 512
sql sha hash code
java sha 2 usage
mysql one-way hashing algorithms
how to generate oracle hash password
linux create SHA-2
sha2+Example
sha512 java source
linux script generate hash
create SHA2 java password
apache + sha2
java sha1 vs sha2
creating sha2 hash in java
sha-512 java
java program for SHA 256 algorithm
java sha-256 secure login
como obter hash sha 152 em sql server
oracle plsql digest sha
Oracle SHA-2 support
php sha-2
bash create hashed string
generating sha 256 hash c#
java sha hashing example
linux sha2
Upgrade Password Hashing Algorithm to SHA-512
generate oracle hashed password java
linux create password sha256
php support for sha 2
sha2 shell script
sql 2005 sha2
java sha-2 256
java sha 512
create unix password hashstring java
oracle hash function secure
sha 256 aix
linux sha generate
java sha-2 alogorithm
bash получить sha256
java sha-2 example
SHA-2 ALGORITHM c++ code
java encryption using SHA 256
java hash sha512
AIX sha256
bash generate sha1
JAVA support SHA-2
sha256 sql2005
example SHA-2
hashing in java produces different results in Unix and Windows
SHA c code example linux
c++ create sha passwords
aix password sha
sha-2 implementation source code c
pl sql hashing function sha 256 algorithm
sha256 hash in oracle oracle
java hash sha-2 example code
sha256 hash sqlserver
sha2 php
creating sha-2 login
one way hashing in oracle with example
java sha256 hash example
code sha1 hash function in pl/sql
C# SHA 256 sample
java sha2 encrypt string
Java SHA512 example
sha2 hash c++
java sha performance
sha use us government application
mysql sha256
“C#” “JAVA” “Hash” “Functions”
java sha256 example
sha512 php
sha1 or sha2?
SHA2 oracle application server
login sha-2
“java 6″ make sha-1 hash
hash C# sha256 using digest key
SHA-256 Oracle hashing
hashing algorithm to generate password + java
sample sha-2 implementation in java
using sha-2 sql server
sha2 password hashing in java
sha2 + java password hashing
sqlserver function to perform sha256 hashing
sample sqlserver clr function to perform sha256 hashing
generating SHA-2
create sha 256 linux
c hash sha256 unix
Oracle SHA-256
hash function SHA 2
how create hash in java SHA-2
sha2 256 java
sha2-256 algorithm c
hashing files sha-2 c# source code
sha2 algorithm
implement sha256 plpgsql
oracle SHA-256 encryption
phpseclib
java SHA2 from string
sha2 hash java
SHA-2 java
sha algorithm script bash
aix hash password bash
PLSQL OR “pl/sql” SHA-2 OR “sha 256″ OR SHA256
hash sha2 c# example
SHA2 sql server 2005
c++ hash function sha2
sha2 java example
java sha2 hash function
java hash function sha 2
sha2 c++
generate sha256 hash c++
unix script to generate sha1 mesage digest
Tags: ,