MD5算法的T-SQL实现(FOR SQL2000)(一)
时间:2007-11-09 来源:不详 作者:迈克DB
WHEN 29 THEN 1073741823 -- 00111111111111111111111111111111
WHEN 30 THEN 2147483647 -- 01111111111111111111111111111111
ELSE 0
END
RETURN(@iRes)
END
GO
IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[MD5_m_2Power]') AND xtype IN(N'FN', N'IF', N'TF'))
DROP FUNCTION [dbo].[MD5_m_2Power]
GO
/*****************************************************************************
* Name: MD5_m_2Power
* Description: 常数组
*****************************************************************************/
CREATE FUNCTION dbo.MD5_m_2Power(
@i TINYINT
)
RETURNS INT
WITH ENCRYPTION
AS
BEGIN
DECLARE @iRes INT
SELECT @iRes =
CASE @i
WHEN 0 THEN 1 -- 00000000000000000000000000000001
WHEN 1 THEN 2 -- 00000000000000000000000000000010
WHEN 2 THEN 4 -- 00000000000000000000000000000100 织梦内容管理系统
WHEN 3 THEN 8 -- 00000000000000000000000000001000
WHEN 4 THEN 16 -- 00000000000000000000000000010000
WHEN 5 THEN 32 -- 00000000000000000000000000100000
WHEN 6 THEN 64 -- 00000000000000000000000001000000
WHEN 7 THEN 128 -- 00000000000000000000000010000000
WHEN 8 THEN 256 -- 00000000000000000000000100000000
WHEN 9 THEN 512 -- 00000000000000000000001000000000
WHEN 10 THEN 1024 -- 00000000000000000000010000000000
WHEN 11 THEN 2048 -- 00000000000000000000100000000000
WHEN 12 THEN 4096 -- 00000000000000000001000000000000
WHEN 13 THEN 8192 -- 00000000000000000010000000000000
WHEN 14 THEN 16384 -- 00000000000000000100000000000000
WHEN 15 THEN 32768 -- 00000000000000001000000000000000
WHEN 16 THEN 65536 -- 00000000000000010000000000000000
内容来自dedecms
WHEN 17 THEN 131072 -- 00000000000000100000000000000000
WHEN 18 THEN 262144 -- 00000000000001000000000000000000
WHEN 19 THEN 524288 -- 00000000000010000000000000000000
WHEN 20 THEN 1048576 -- 00000000000100000000000000000000
WHEN 21 THEN 2097152 -- 00000000001000000000000000000000
WHEN 22 THEN 4194304 -- 00000000010000000000000000000000
WHEN 23 THEN 8388608 -- 00000000100000000000000000000000
WHEN 24 THEN 16777216 -- 00000001000000000000000000000000
WHEN 25 THEN 33554432 -- 00000010000000000000000000000000
WHEN 26 THEN 67108864 -- 00000100000000000000000000000000
WHEN 27 THEN 134217728 -- 00001000000000000000000000000000
WHEN 28 THEN 268435456 -- 00010000000000000000000000000000
WHEN 29 THEN 536870912 -- 00100000000000000000000000000000
文章评论
共有位Admini5网友发表了评论 查看完整内容