This Article explains you how to Encrypt and Decrypt a text in sql server
EncryptByPassPhrase:
Syntax: ENCRYPTBYPASSPHRASE
('PASSPHRASE',
‘text’)
creating table Login table
create table login(id int identity(1,1),username varchar(10),password varchar(100))
insert into login (username,password)values('Ramprasad',EncryptByPassPhrase('12','AAA'))
insert into login (username,password)values('venkat',EncryptByPassPhrase('12','BBB'))
insert into login (username,password)values('hemanth',EncryptByPassPhrase('12','CCC'))
select * from login
id username password
1 Ramprasad
2 venkat
3 hemanth
now we are not able to see the passwords .To visible the Passwords we need to Decrypt the passwords
DecryptByPassPhrase:
DecryptPassPhrase takes two parameters one is 'PASSPHRASE'and text or column_name
select id,username,convert(varchar(10), DECRYPTBYPASSPHRASE ('12',password)) from login
select id,username,convert(varchar(10), DECRYPTBYPASSPHRASE ('12',password)) from login
Comments
Post a Comment