Tuesday, 20 October 2015

Encrypt and Decrypt password using sql server query



//1.   with query and parameter

declare @encrypt varbinary(200)
select @encrypt = EncryptByPassPhrase('key', 'abc' )
select @encrypt

select convert(varchar(100),DecryptByPassPhrase('key',@encrypt))


//2.   with query and direct value

declare @encrypt varbinary(200)
select @encrypt = EncryptByPassPhrase('key', 'abc' )
select @encrypt

select convert(varchar(100),DecryptByPassPhrase('key',0x01000000B97F1BA787918D419080AA009A4AC2B04628AFEAC1C1FBFD))

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...