Gyula,

    Assuming your not on a version or Oracle that supports DBMS_OBFUSCATION you
can try the following package.  It's actually been copied from a Metalink doc.

create or replace package encrypt as
   function code(inp_data varchar2, key varchar2 default '<your desired value>')
return varchar2;
   pragma restrict_references(code, RNDS, WNDS, WNPS);
end;
/

create or replace package body encrypt is

   function convbin(c1 varchar2) return varchar2 is
     loop1 number;
     value number;
     divis number;
     r1 varchar2(30);
   begin
     r1 := '';
     divis := 128;
     value := ascii(c1);
     for loop1 in 0..7 loop
       if(trunc(value/divis) = 1) then
         r1 := r1||'1';
       else
         r1 := r1||'0';
       end if;
       value := mod(value, divis);
       divis := divis/2;
     end loop;
     return r1;
   end;
   
   function code(inp_data varchar2, key varchar2 default '<your desired value>')
return varchar2 is
     loop1 number;
     loop11 number;
     r1 varchar2(8);
     r2 varchar2(8);
     key1 varchar2(4000);
     r3 number;
     result varchar2(40);
     divis number;
   begin
     key1 := key;
     while (length(inp_data) > length(key1)) loop
       key1 := key1||key1;
     end loop;
     result := '';
     for loop1 in 1..length(inp_data) loop
       r1 := convbin(substr(inp_data,loop1,1));
       r2 := convbin(substr(key1,loop1,1));
       divis := 128;
       r3 := 0;
       for loop11 in 1..8 loop
         if(to_number(substr(r1,loop11,1))+to_number(substr(r2,loop11,1)) = 1)
then
             r3 := r3+divis;
         end if;
         divis := divis/2;
       end loop;
       result := result||chr(r3);
     end loop;
     return result;
   end;
end;
/

grant execute on encrypt to public;
create public synonym encrypt for system.encrypt;

   

____________________Reply Separator____________________
Author: "Andor; Gyula" <[EMAIL PROTECTED]>
Date:       5/3/2001 1:35 AM

Hi Gurus !

Is there any standard method to encrypt data? We are making an application
that uses application-level privilege system, so we should store passwords
for users. Of course we want to store encrypted passwords, but we don't know
if is there an existing way for this or try develop own encryption. What do
you suggest?

Thanks in advance
Gyula



-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Andor, Gyula
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to