MD5使用方法
Published: Comment: No Comments
Last Modified:2024-08-12 00:03:48
将WZ_MD5_MOD.dll 文件复制到SQL的Binn目录
查询分析器内
第一步运行 选择MASTER库
use master
go
sp_addextendedproc 'XP_MD5_EncodeKeyVal', 'WZ_MD5_MOD.dll'
go
第二部运行
sp_addextendedproc 'XP_MD5_CheckValue', 'WZ_MD5_MOD.dll'
go
第三步选择运行 选择muonline库
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UFN_MD5_CHECKVALUE]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[UFN_MD5_CHECKVALUE]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UFN_MD5_ENCODEVALUE]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[UFN_MD5_ENCODEVALUE]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
第四步运行
CREATE FUNCTION UFN_MD5_CHECKVALUE
(
@btInStr VARCHAR(10),
@btInStrIndex VARCHAR(10),
@btInVal BINARY(16)
)
RETURNS TINYINT
AS
BEGIN
DECLARE @iOutResult TINYINT
EXEC master..XP_MD5_CheckValue @btInStr, @btInVal, @btInStrIndex, @iOutResult OUT
RETURN @iOutResult
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
第5步运行
CREATE FUNCTION UFN_MD5_ENCODEVALUE
(
@btInStr VARCHAR(10),
@btInStrIndex VARCHAR(10)
)
RETURNS BINARY(16)
AS
BEGIN
DECLARE @btOutVal BINARY(16)
EXEC master..XP_MD5_EncodeKeyVal @btInStr, @btInStrIndex, @btOutVal OUT
RETURN @btOutVal
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
注册代码为:
INSERT INTO memb_info (memb___id, memb__pwd,memb_name,sno__numb,bloc_code,ctl1_code) VALUES ('"&trim(account)&"',[dbo].UFN_MD5_ENCODEVALUE&"','"&trim(account)&"'),'"&trim(account)&"',1111111111111,0,1)