程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> SqlServer數據庫 >> 關於SqlServer >> T-SQL MD5算法實現

T-SQL MD5算法實現

編輯:關於SqlServer
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
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved