Implementing One-way Encryption in PHP | Linux Today

Implementing One-way Encryption in PHP

Written By
Web Webster
Web Webster
May 19, 2010

“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.”


Complete Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.