MD5算法的T-SQL实现(FOR SQL2000)(二)
时间:2007-11-09 来源:不详 作者:迈克DB
WHEN 3 THEN '3'
WHEN 4 THEN '4'
WHEN 5 THEN '5'
WHEN 6 THEN '6'
WHEN 7 THEN '7'
WHEN 8 THEN '8'
WHEN 9 THEN '9'
WHEN 10 THEN 'A'
WHEN 11 THEN 'B'
WHEN 12 THEN 'C'
WHEN 13 THEN 'D'
WHEN 14 THEN 'E'
WHEN 15 THEN 'F'
ELSE '' END
CASE @iTmp % 16 WHEN 0 THEN '0'
WHEN 1 THEN '1'
WHEN 2 THEN '2' 织梦内容管理系统
WHEN 3 THEN '3'
WHEN 4 THEN '4'
WHEN 5 THEN '5'
WHEN 6 THEN '6'
WHEN 7 THEN '7'
WHEN 8 THEN '8'
WHEN 9 THEN '9'
WHEN 10 THEN 'A'
WHEN 11 THEN 'B'
WHEN 12 THEN 'C'
WHEN 13 THEN 'D'
WHEN 14 THEN 'E'
WHEN 15 THEN 'F'
ELSE '' END
SET @iCount = @iCount 1
END
RETURN(@sRes)
END
GO
IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[MD5]') AND xtype IN(N'FN', N'IF', N'TF')) 织梦好,好织梦
DROP FUNCTION [dbo].[MD5]
GO
/*****************************************************************************
* Name: MD5
* Description: MD5
*****************************************************************************/
CREATE FUNCTION dbo.MD5(
@sOrigMess NVARCHAR(4000)
)
RETURNS CHAR(32)
WITH ENCRYPTION
AS
BEGIN
--====================================
DECLARE @S11 TINYINT
DECLARE @S12 TINYINT
DECLARE @S13 TINYINT
DECLARE @S14 TINYINT
DECLARE @S21 TINYINT
DECLARE @S22 TINYINT
DECLARE @S23 TINYINT
DECLARE @S24 TINYINT
DECLARE @S31 TINYINT
DECLARE @S32 TINYINT
DECLARE @S33 TINYINT
DECLARE @S34 TINYINT
DECLARE @S41 TINYINT
DECLARE @S42 TINYINT
DECLARE @S43 TINYINT
DECLARE @S44 TINYINT
SELECT @S11 = 7, @S12 = 12, @S13 = 17, @S14 = 22
文章评论
共有位Admini5网友发表了评论 查看完整内容