Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi everyone, I am trying to write a SQL function to allow me to encrypt and decrypt between integers and bits.Could any one provide some guidance toward how to write this function? Thanks a lot - Sam
Sachin.Nand
2937 Posts
Posted - 2011-01-12 : 06:18:21
The most simple way is using Hashbyte with MD5,SH1 etc algorithm.But the drawback is it cannot be decrypted into its original format but you can check its existence
declare @tbl table(id int)insert @tblselect HASHBYTES('MD5','MyPassword')select * from @tbl where id= HASHBYTES('MD5','MyPassword')select * from @tbl where id= HASHBYTES('MD5','NotMyPassword')