Best Option For Hashing Your Passwords In PHP

Author : Code With Mark

It is a good practice to hash your user’s password before storing into your database. But which hashing option should you use in php.

Why Hash Your Passwords

For security reason, you should always hash your passwords. In the event of if your system gets hacked. Hackers can easily access your user’s info like credit card and other personal data.


Standard Hash

Most web developers just hash their passwords like this:

$data = "codewithmark";

//Method 1


//Method 2


//Output will be


More Password Hashing Options

Below is a table that contains all the different hash options in php

Hash Name Characters In Length
md2 32
md4 32
md5 32
sha1 40
sha224 56
sha256 64
sha384 96
sha512 128
ripemd128 32
ripemd160 40
ripemd256 64
ripemd320 80
whirlpool 128
tiger128,3 32
tiger160,3 40
tiger192,3 48
tiger128,4 32
tiger160,4 40
tiger192,4 48
snefru 64
snefru256 64
gost 64
gost-crypto 64
adler32 8
crc32 8
crc32b 8
fnv132 8
fnv1a32 8
fnv164 16
fnv1a64 16
joaat 8
haval128,3 32
haval160,3 40
haval192,3 48
haval224,3 56
haval256,3 64
haval128,4 32
haval160,4 40
haval192,4 48
haval224,4 56
haval256,4 64
haval128,5 32
haval160,5 40
haval192,5 48
haval224,5 56
haval256,5 64


How To Hash

You can easily hash your password from the above table like this


hash(HashName, $data);

$data = 'codewithmark';

//Option 1


//Option 2


//Option 3


Sharing is caring:            

You might also like

What Are Transactional Emails

Introducing Awesome Functions Library

Create Unique ID Like Youtube Video URL ID

How To Create A Secure Login System With PHP And MySQL

Convert Your API JSON Data to HTML Table

Did you find this helpful?