MD5算法的T-SQL实现(FOR SQL2000)(二)
时间:2007-11-09 来源:不详 作者:迈克DB
SET @a = dbo.MD5_AddUnsigned(@a, @AA)
SET @b = dbo.MD5_AddUnsigned(@b, @BB)
SET @c = dbo.MD5_AddUnsigned(@c, @CC)
SET @d = dbo.MD5_AddUnsigned(@d, @DD)
SET @iWordArrayCount = @iWordArrayCount 16
END
SET @sRes = dbo.MD5_WordToHex(@a) dbo.MD5_WordToHex(@b) dbo.MD5_WordToHex(@c) dbo.MD5_WordToHex(@d)
SET @sRes = LOWER(@sRes)
RETURN(@sRes)
END
GO
--Test
set nocount on
select dbo.MD5('') as 'MD5('''')'
union
select 'd41d8cd98f00b204e9800998ecf8427e'
select dbo.MD5('a') as 'MD5(''a'')'
union
select '0cc175b9c0f1b6a831c399e269772661'
select dbo.MD5('abc') as 'MD5(''abc'')'
union
select '900150983cd24fb0d6963f7d28e17f72'
select dbo.MD5('message digest') as 'MD5(''message digest'')'
union
select 'f96b697d7cb7938d525a2f31aaf161d0'
select dbo.MD5('abcdefghijklmnopqrstuvwxyz') as 'MD5(''abcdefghijklmnopqrstuvwxyz'')'
union
select 'c3fcd3d76192e4007dfb496cca67e13b' 内容来自dedecms
select dbo.MD5('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') as 'MD5(''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'')'
union
select 'd174ab98d277d9f5a5611c2c9f419d9f'
select dbo.MD5('12345678901234567890123456789012345678901234567890123456789012345678901234567890') as 'MD5(''12345678901234567890123456789012345678901234567890123456789012345678901234567890'')'
union
select '57edf4a22be3c955ac49da2e2107b67a'
select dbo.MD5('我') as 'MD5(''我'')'
union
select 'a31d0f25367ebe046897f8a939ca4a9f'
文章评论
共有位Admini5网友发表了评论 查看完整内容