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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL Function questions

Author  Topic 

samer1
Starting Member

1 Post

Posted - 2011-01-12 : 06:04:03
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 @tbl
select HASHBYTES('MD5','MyPassword')

select * from @tbl where id= HASHBYTES('MD5','MyPassword')
select * from @tbl where id= HASHBYTES('MD5','NotMyPassword')


PBUH

Go to Top of Page
   

- Advertisement -