/    Sign up×
Community /Pin to ProfileBookmark

Okay I’m building a database that contains sensitive data, I may have went about this the wrong way, but I’m not sure.

I use something like this md5($lastname.$sensitive.$phonenumber)

Now, when I go to edit that row in an admin panel, I need to be able to read back what was encrypted.. is there a way to do this, or no?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiFeb 13.2009 — The short answer is no. md5 is designed to be one way.
Copy linkTweet thisAlerts:
@OctoberWindFeb 13.2009 — You can check inputs against a stored md5 hash for validity.

Lets say it's a password recovery script.


When users sign up, you ask them for three things, their last name, any number of security questions and their phone number, which are all combined and stored in the database with the md5 hash.

Now, when it comes time to recover or reset the password, you ask those same questions and compare the hashed inputs with the stored hash in the database.

[code=php]
if (md5($lastname . $sensitive . $phonenumber) === $storedHash) {
// true (=== is identical; equal to and of the same type)
}
else {
// false
}[/code]
×

Success!

Help @cinematic_jesi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...