Created
April 9, 2015 02:30
-
-
Save jrdmb/ed98716aab76f73f9276 to your computer and use it in GitHub Desktop.
Sql Server String Encryption
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT HASHBYTES('sha2_512', 'mypassword') | |
--algorithms: MD2 | MD4 | MD5 | SHA | SHA1 | SHA2_256 | SHA2_512 | |
declare @enc varbinary(256) | |
select @enc = EncryptByPassPhrase('key', 'mypassword' ) | |
--returns: 0x01000000D6191ADF19FF136F0A82E469E55AF781FC9D61904BA73039971C82FE88D3E758 | |
select Cast(DECRYPTBYPASSPHRASE('key', @enc) as varchar(4000)) | |
-- #sqlserver #tsql #encryption |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment