We write all about Webmaster needs.

Encrypting Data Using PHP

ADVERTISEMENT



If your database table contains user name and password, if you are storing user name and password directly into database table without encrypting it may become a problem. If any intruders hack your database they can track out secret passwords and they can misuse it. At least password field should be encrypted before it is stored in database.

By default PHP provides MD5 encryption technique which doesn’t have decryption algorithm. So its difficult to decrypt an encrypted content via MD5.

What is MD5 ?

Wikipedia Says:

MD5 (Message-Digest algorithm 5) is a widely used cryptographic hash function with a 128-bit hash value. As an Internet standard (RFC 1321), MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of files

Most Web developers mostly use MD5 concept to encrypt in PHP(Front end). MD5 function is simply a secured one to encrypt your data and save it in back end(MySQL).

Example code

<?php
$str="welcome";
echo md5($str);
?>

The output will be 40be4e59b9a2a2b5dffb918c0e86b3

Pages

Blogroll

RSS Syndication