SQL2005 des加密算法存储过程
http://blog.csdn.net/fuyajun001/article/details/5616320
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Sql代码 CREATE SYMMETRIC KEY key1 WITH ALGORITHM=DES ENCRYPTION BY PASSWORD='abc$123' GO OPEN SYMMETRIC KEY key1 DECRYPTION BY PASSWORD='abc$123' DECLARE @str NVARCHAR(100),@Encrypted VARBINARY(MAX) SET @str=N'要加密的字串' SELECT @Encrypted=ENCRYPTBYKEY(KEY_GUID('key1'),@str) SELEcT '加密'=@Encrypted ,'解密'=CAST(DECRYPTBYKEY(@Encrypted) AS NVARCHAR(100)) CLOSE SYMMETRIC KEY key1 GO DROP SYMMETRIC KEY key1 GO |