Password Hashes in PHP
Hello friends now we are discussing about some simple
security tricks in php, mainly on handling passwords using php. This section
explains why password hashing and how can we use hashing.
Why
Every god programmer’s know storing password in form of
clear text is bad method of programing .this make user and programmer at risk. This
is the main reason why password hashing is used .password hashing are working
on the basics of cryptography.
“In cryptography, a cryptographic hash function is a
transformation that takes an input and returns
a fixed-size string, which is called the hash value.”
By applying hashing algorithm’s they make user’s password’s strong.it
make difficult to Attackers. PHP offers so simple inbuilt methods to create hashes,
such as md5 (), sh1 (), ssha () etc.
How hashing in PHP
There are different algorithm’s for creating a hash of a
test most popular are md5() and sha()now we disusing about those two first.
<?php $str = "Hello"; echo md5($str); ?>
The output of the code above will be:
8b1a9953c4611296a827abf8c47804d7
<?php $str = 'Hello'; echo sha1($str); ?>
The output of the code above will be:
f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0
In the above example md5 can create a 128 bit of hash from
given text, and second one is sha1. It can make 160 bit hash from given password
text. But md5 and sha algorithms can decrypt easly with help of rainbow tables.so
we need to use next level algorithms.
2 comments:
This info is worth everyone's attention. Where can I find out more?
My web blog ... anteporticos
Nice :)
visit us.
https://gomoogomoo.com
Post a Comment