上传文件至 /
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
---BSERP2/3/E3 用户密码解密
|
||||||
|
if exists(select 1 from sysobjects where name='fn_bsuser_pwdjm' and xtype='fn')
|
||||||
|
drop function fn_bsuser_pwdjm
|
||||||
|
go
|
||||||
|
|
||||||
|
create function fn_bsuser_pwdjm(@pwd varchar(200))
|
||||||
|
---BSERP2/3/E3 用户密码解密
|
||||||
|
returns varchar(200)
|
||||||
|
as
|
||||||
|
begin
|
||||||
|
declare @Y varchar(200)='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
|
||||||
|
@J varchar(200)='qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM9147038562',
|
||||||
|
@i int=0,
|
||||||
|
@num int,
|
||||||
|
@result varchar(200)=''
|
||||||
|
|
||||||
|
while @i<len(@pwd)
|
||||||
|
begin
|
||||||
|
set @num = charindex(substring(@pwd,@i+1,1),@J)
|
||||||
|
if @num >0
|
||||||
|
set @result = @result+substring(@Y,charindex(substring(@pwd,@i+1,1),@J),1)
|
||||||
|
else
|
||||||
|
set @result = @result+substring(@pwd,@i+1,1)
|
||||||
|
|
||||||
|
set @i+=1
|
||||||
|
end
|
||||||
|
return(@result)
|
||||||
|
end
|
||||||
|
|
||||||
|
go
|
||||||
|
|
||||||
|
select userid,name,dbo.fn_bsuser_pwdjm(PASSWORD) from bsuser
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
use [BS3000+_SYSTEM]
|
||||||
|
|
||||||
|
GO
|
||||||
|
IF EXISTS (SELECT 1 FROM SYS.objects WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[fn_sm_user]') AND TYPE IN (N'FN', N'IF', N'TF', N'FS', N'FT'))
|
||||||
|
DROP FUNCTION fn_sm_user
|
||||||
|
GO
|
||||||
|
|
||||||
|
create function fn_sm_user(@psw varchar(100))
|
||||||
|
returns varchar(50)
|
||||||
|
as
|
||||||
|
begin
|
||||||
|
declare @result varchar(50), --结果
|
||||||
|
@cout int, --每3位一组数量
|
||||||
|
@psw_new varchar(100), --新秘钥
|
||||||
|
@num int --截取3位数
|
||||||
|
|
||||||
|
set @result = ''
|
||||||
|
set @psw = REPLACE(@psw,'/U','')
|
||||||
|
set @psw_new = REPLACE(@psw,'+','')
|
||||||
|
set @cout = LEN(@psw)/3
|
||||||
|
|
||||||
|
if @cout=0
|
||||||
|
begin
|
||||||
|
set @result = '无密码'
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
WHILE LEN(@psw_new)>0
|
||||||
|
begin
|
||||||
|
select @num = cast(SUBSTRING(@psw_new,1,3) as int)
|
||||||
|
begin
|
||||||
|
IF @num<126
|
||||||
|
begin
|
||||||
|
select @num=@num - 111
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
while(@num>=126)
|
||||||
|
begin
|
||||||
|
select @num=@num - 111
|
||||||
|
end
|
||||||
|
end
|
||||||
|
select @result=@result + cast(CHAR(@num) as CHAR(1))
|
||||||
|
end
|
||||||
|
select @psw_new = STUFF(@psw_new,1,3,'')
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return (@result)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
go
|
||||||
|
|
||||||
|
select vusercode,vusername,dbo.fn_sm_user(vpassword) from sm_user
|
||||||
Reference in New Issue
Block a user