Code With Mark
Home
About
Resources
Contact

Best Option For Hashing Your Passwords In PHP

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

md5($data);

//Method 2

hash('md5',$data);

//Output will be

72b55f9842f425f4b141725367d211da

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

//Syntax

hash(HashName, $data);

$data = 'codewithmark';

//Option 1

hash('sha512',$data);

//Option 2

hash('tiger128,3',$data);

//Option 3

hash('haval128,3',$data);
For Web Developers

Stop Building Websites That Pay You Once.

Use Shiply CMS to launch websites faster, manage clients easier, and turn every project into recurring monthly income.

Start Building Faster 🚀 Download Shiply CMS
How to detect pressing Enter on keyboard using jQuery?How to detect pressing Enter on keyboard using jQuery?←Previous
How To Create A Secure Login System With PHP And MySQLHow To Create A Secure Login System With PHP And MySQLNext→

Related Posts

  • How Google Developers Think (And Why You Should Too)
  • Add Google Sign-In in 2 Minutes
  • Easily Edit HTML Table Rows Or Cells With jQuery

Top Posts Viewed

Using JavaScript Window Onload Event Correctly
68 views
How Google Developers Think (And Why You Should Too)
58 views
Learn To Create YouTube Video Downloader
57 views

Categories

Courses
Excel
Google Script
Javascript
jQuery
Microsoft Access
MongoDB
Node JS
PHP
Quick Tip
Uncategorized
Wordpress