IFEXISTS(SELECT*FROMdbo.sysobjectsWHEREid=OBJECT_ID(N'[dbo].[MD5_m_OnBits]')ANDxtypeIN(N'FN',N'IF',N'TF'))
DROPFUNCTION[dbo].[MD5_m_OnBits]
GO
/*****************************************************************************
*Name:MD5_m_OnBits
*Description:常數組
*****************************************************************************/
CREATEFUNCTIONdbo.MD5_m_OnBits(
@iTINYINT
)
RETURNSINT
WITHENCRYPTION
AS
BEGIN
DECLARE@iResINT
SELECT@iRes=
CASE@i
WHEN0THEN1--00000000000000000000000000000001
WHEN1THEN3--00000000000000000000000000000011
WHEN2THEN7--00000000000000000000000000000111
WHEN3THEN15--00000000000000000000000000001111
WHEN4THEN31--00000000000000000000000000011111
WHEN5THEN63--00000000000000000000000000111111
WHEN6THEN127--00000000000000000000000001111111
WHEN7THEN255--00000000000000000000000011111111
WHEN8THEN511--00000000000000000000000111111111
WHEN9THEN1023--00000000000000000000001111111111
WHEN10THEN2047--00000000000000000000011111111111
WHEN11THEN4095--00000000000000000000111111111111
WHEN12THEN8191--00000000000000000001111111111111
WHEN13THEN16383--00000000000000000011111111111111
WHEN14THEN32767--00000000000000000111111111111111
WHEN15THEN65535--00000000000000001111111111111111
WHEN16THEN131071--00000000000000011111111111111111
WHEN17THEN262143--00000000000000111111111111111111
WHEN18THEN524287--00000000000001111111111111111111
文