Home > Uncategorized > Calculate #PHP equivalent #MD5 Hash in MS #SQL Server

Calculate #PHP equivalent #MD5 Hash in MS #SQL Server

md5

The MD5 hash is a pretty standard and secure hashing algorithm, that is often used to create one-way encryption of sensitive data. Quite often the hash code is generated from the application layer, such as PHP, and needs to be verified at the database layer.

So, let’s say you want to hash the word “password” in SQL server – you just write

select CONVERT(varchar(max),HASHBYTES(‘MD5’, ‘password’),2)

which results in

5F4DCC3B5AA765D61D8327DEB882CF99

Possibly the least secure password in the world!

 

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: