HOW TO ENCRYPT AND DECREYPT PASSWORD BY USING ENCRYPTBYPASSPHRASE AND DECRYPTBYPASSPHRASE IN MSSQL
Channel: SS UNITECH
Date: 2021-06-13

How to encrypt and decrypt data in SQL Server
---Script
declare @hashkey varchar(100)='ssunitech'

select BusinessEntityID,
LoginID,ENCRYPTBYPASSPHRASE(@hashkey,cast(LoginID as varchar(100))) LoginID_H,
ENCRYPTBYPASSPHRASE(@hashkey,'ssunitech@123') as password
Into LoginDetails
from [HumanResources].[Employee]


select *,cast(deCRYPTBYPASSPHRASE('ssunitech',LoginID_H) as varchar(1000)) ,
         cast(deCRYPTBYPASSPHRASE('ssunitech',password) as varchar(1000)) 
from LoginDetails



Find Us On YouTube- "Subscribe Channel to watch Database related videos"          https://www.youtube.com/channel/UCZA_5vGtSpZu86VBDdSnSag

For SQL Quiz-
https://www.youtube.com/watch?v=IaDXFyZSo7Y&list=PLNRxk1s77zfitFbrlRICVDgVodMr25mYl
 
Find Us On FaceBook-
https://www.facebook.com/SS-Unitech-187705388674384/