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!

 

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

Leave a comment