oracle 的加密解密函数

---加密---
FUNCTION decrypt(outpass in varchar2)
RETURN varchar2 IS
string_in varchar2(78);
string_out varchar2(39);
offset number(2);
inpass varchar2(30);

BEGIN
  string_in :='YN8K1JOZVURB3MDETS5GPL27AXWIHQ94C6F0#$_';
  string_out :='_$#ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 
  offset:=instr(string_in,substr(outpass,1,1));
  string_in:=string_in||string_in;
  string_in:=substr(string_in,offset,39);
  inpass:=translate(upper(substr(outpass,2)),
          string_out,string_in);
return inpass;
end;

---解密---

FUNCTION encrypt (inpass in varchar2)
RETURN varchar2 IS
string_in varchar2(78);
string_out varchar2(39);
offset number(2);
outpass varchar2(30);
BEGIN
 offset :=to_number(to_char(sysdate,'ss'))mod 39;
 string_in :='YN8K1JOZVURB3MDETS5GPL27AXWIHQ94C6F0#$_';
 string_out :='_$#ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 
 outpass :=substr(string_in,offset,1);
 string_in :=string_in||string_in;
 string_in :=substr(string_in,offset,39);
 outpass :=outpass||translate(upper(inpass),
          string_in,string_out);
 return outpass;
END;

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭