블로그 이미지
Sunny's

calendar

1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

Notice

2009. 3. 13. 10:32 MSSQL


-- 데이터 암호화
Declare @Key varchar(100)
SET @Key = 'aa'

DECLARE @Data varchar(MAX)  
Set @Data = 'abcdeft'

Declare @Encrypt varbinary(max)
SET @Encrypt = EncryptByPassPhrase(@Key, @Data)

Declare @Decrypt varchar(max)
SET @Decrypt = DecryptByPassPhrase(@Key, @Encrypt)


select @Encrypt As 암호화
select @Decrypt As 복호화


 

-- 내부 함수 이용 MD5

DECLARE @Data varchar(MAX)  
Set @Data = '기본제공함수'

Select  SubString(master.dbo.fn_varbintohexstr(HashBytes('MD5', @Data)), 3, 32) 

 

-- 외부 Dll이용MD5

http://www.codeproject.com/KB/database/xp_md5.aspx

posted by Sunny's