SQL Server MD5 SHA1 encryption

 declare @md5 varchar(40);

--garbled

 SELECT @md5 = hashbytes('MD5', '1') ;

 print @md5; 

--normal

 SELECT @md5=sys.fn_VarBinToHexStr(hashbytes('MD5', '1'))

 print SUBSTRING(@md5, 3, 35);

 print UPPER(SUBSTRING(@md5, 3, 35));

 

 SELECT @md5=sys.fn_VarBinToHexStr(hashbytes('SHA1', '1'))

 print SUBSTRING(@md5, 3, 35);

 print UPPER(SUBSTRING(@md5, 3, 35));

 

Reference:

1.  http://blog.chinaunix.net/uid-10697776-id-2935575.html

 MD5 encryption implementation method in SQLServer - distinguish 32-bit and 16-bit encryption

http://blog.sina.com.cn/s/blog_49540f440100hy9h.html

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326776895&siteId=291194637