View Single Post
Old 07-10-2006, 7:07 AM   #1
eric
MK PitStop Member
 
eric's Avatar
 
Join Date: Jul 2006
Posts: 50
My Photos: ()
iTrader: (0)

Banked:
MK Cash: $0.00

I am Worth:
MK Cash: $0.04
Donate

Recent Blog: None

eric is on a distinguished road
Default Encription in Oracle

here is a simple program is wrote for one of my projects to encript data in Oracle.
create or replace function estring(p_var varchar2)
return varchar2
is
v_estr varchar2(255);
v_elength number;
ipos number;
xor number;
begin
--Ensure password IS NOT case-sensitive
p_var := lower(p_var);
--Only encrypt IF parameter IS NOT NULL
if p_var is not null then
v_elength := length(p_var);
-- CREATE the KEY using a combination the the lenth OF the password +
the pos of the 3rd char found in the PW.
xor := v_elength + instr(p_var, substr(p_var, 3, 1));
ipos := 1;
v_estr := '';
while ipos <= v_elength loop
v_estr := v_str || to_char(to_ascii(substr(p_var, ipos, 1)) ^ xor);
ipos := ipos + 1;
end loop;
return(v_estr);
else
v_estr := null;
return(v_estr);
end if;
end estring
eric is offline   Reply With Quote
Advertisements