This Domain(Admin5.com) is for Sale:

MD5算法的T-SQL实现(FOR SQL2000)(一)

时间:2007-11-09  来源:不详  作者:迈克DB

      WHEN 30 THEN 1073741824  -- 01000000000000000000000000000000
      ELSE 0
    END
  RETURN(@iRes)
END
GO

IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[MD5_LShift]') AND xtype IN(N'FN', N'IF', N'TF'))
  DROP FUNCTION [dbo].[MD5_LShift]
GO
/*****************************************************************************
* Name: MD5_LShift
* Description: MD5_LShift
*****************************************************************************/
CREATE FUNCTION dbo.MD5_LShift(
   @iValue    INT
  ,@iShiftBits  TINYINT
)
RETURNS INT
WITH ENCRYPTION
AS
BEGIN
  DECLARE @iRes  BIGINT
  SET @iRes = CAST(@iValue AS BINARY(8))
  SET @iRes = @iRes * dbo.MD5_m_2Power(@iShiftBits)
  RETURN(CAST(@iRes & 0x00000000FFFFFFFF AS BINARY(4)))
END
GO

IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[MD5_RShift]') AND xtype IN(N'FN', N'IF', N'TF'))
  DROP FUNCTION [dbo].[MD5_RShift]

dedecms.com


GO
/*****************************************************************************
* Name: MD5_RShift
* Description: MD5_RShift
*****************************************************************************/
CREATE FUNCTION dbo.MD5_RShift(
   @iValue    INT
  ,@iShiftBits  TINYINT
)
RETURNS INT
WITH ENCRYPTION
AS
BEGIN
  DECLARE @iRes  BIGINT
  SET @iRes = CAST(@iValue AS BINARY(8))
  SET @iRes = @iRes / dbo.MD5_m_2Power(@iShiftBits)
  RETURN(CAST(@iRes & 0x00000000FFFFFFFF AS BINARY(4)))
END
GO

IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[MD5_RotateLeft]') AND xtype IN(N'FN', N'IF', N'TF'))
  DROP FUNCTION [dbo].[MD5_RotateLeft]
GO
/*****************************************************************************
* Name: MD5_RotateLeft
* Description: MD5_RotateLeft
*****************************************************************************/
CREATE FUNCTION dbo.MD5_RotateLeft(
   @iValue    INT dedecms.com
  ,@iShiftBits  TINYINT
)
RETURNS INT
WITH ENCRYPTION
AS
BEGIN
  RETURN(dbo.MD5_LShift(@iValue, @iShiftBits) | dbo.MD5_RShift(@iValue, (32 - @iShiftBits)))
END
GO

IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[MD5_AddUnsigned]') AND xtype IN(N'FN', N'IF', N'TF'))
  DROP FUNCTION [dbo].[MD5_AddUnsigned]
GO
/*****************************************************************************
* Name: MD5_AddUnsigned
* Description: MD5_AddUnsigned
*****************************************************************************/
CREATE FUNCTION dbo.MD5_AddUnsigned(
   @iX    INT
  ,@iY    INT
)
RETURNS INT
WITH ENCRYPTION
AS
BEGIN
  DECLARE @iRes  BIGINT
  SET @iRes = CAST(CAST(@iX AS BINARY(8)) AS BIGINT) CAST(CAST(@iY AS BINARY(8)) AS BIGINT)
  RETURN(CAST(@iRes & 0x00000000FFFFFFFF AS BINARY(4)))
END
GO

IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[MD5_F]') AND xtype IN(N'FN', N'IF', N'TF'))

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容

24小时热门信息