Implementing One-way Encryption in PHP
May 18, 2010, 22:32 (0 Talkback[s])
(Other stories by Leidago Noabeb)
No-Size-Fits-All! An Application-Down Approach for Your Cloud Transformation REGISTER >
"This article is a follow up to my previous article on PHP
encryption techniques. To demonstrate one-way encryption in PHP,
this article describes how to start building a secure online diary
application. The one-way encryption will allow the diary to log a
user in and generally encrypt the contents of the file that it
loads. How It Works
"First, the user has to log into the diary. This ensures that
only the person that is supposed to use the diary has access to it.
We will use one-way hashing to ensure password safety. The user
will be presented with an HTML form that will take a password and
then compare it to the stored hash algorithm.
"Both the password and the diary contents will be stored in a
file. Because PHP works mighty fine with MySQL, we will create some
code to show how to store both pieces of information in a MySQL
database as well. So you will have not only the option to store
them in either the database or file, but you will also have the
code to make it possible.
"After a user has logged in, they will be transferred to the
editor page where they will be presented with unencrypted text in a
text box... Hold that thought, let's start from the beginning."