no

How to Insert an Md5 Password in Mssql

To md5 a string in mssql we execute this query: select HASHBYTES('MD5', 'password') //But this has a problem because it re...

To md5 a string in mssql we execute this query:
select HASHBYTES('MD5', 'password')

//But this has a problem because it returns a VarBinary data type which is a garbled text. So it should be converted first to NVarchar:
SELECT CONVERT(NVARCHAR(32),HashBytes('MD5', 'password'),2)

//To insert in the database
insert into Users (username, password) values ('user', (SELECT CONVERT(NVARCHAR(32),HashBytes('MD5', 'password'),2)))

Related

rdbms 5626659301861208977

Post a Comment Default Comments

1 comment

Anonymous said...

Thanks it was helpful

Outsourcing

Are you looking for freelancers in the Philippines? Get in touch.

Donations

If you like what I do, you can support this channel by buying me a coffee. I would be grateful for your contribution! Your donations will help me create more FREE online courses and learning materials for programmers and remote workers.

item