Xref: alice comp.databases.oracle:75857 comp.databases.oracle.server:65357
Path: alice!news-feed.fnsi.net!newsfeed.icl.net!newsfeed.axxsys.net!nntp.abs.net!dca1-hub1.news.digex.net!intermedia!cyclone.swbell.net!typhoon-sf.snfc21.pbi.net.POSTED!not-for-mail
Message-ID: <37D88B3C.F441A7E4@yahoo.com>
From: S Schaber <sschaber@yahoo.com>
X-Mailer: Mozilla 4.61 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.databases.oracle,comp.databases.oracle.server
Subject: Re: dbms_crypto_toolkit error
References: <37D6A602.BD6E7A9@yahoo.com> <7rbr5g$p3v$1@inet16.us.oracle.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 134
Date: Thu, 09 Sep 1999 21:38:21 -0700
X-Complaints-To: abuse@pacbell.net
X-Trace: typhoon-sf.snfc21.pbi.net 937024712 63.193.112.24 (Fri, 10 Sep 1999 21:38:32 PDT)
NNTP-Posting-Date: Fri, 10 Sep 1999 21:38:32 PDT
Organization: SBC Internet Services

I'm not trying to generate random numbers. I want to encrypt strings using
either encrypt or hash procedure in dbms_crypto_toolkit. Do you have an
example that uses these procedures?

Thanks,
Steve.

Yass Khogaly wrote:

> Please follow those steps "TO GENERATE RANDOM NUMBERS"
>
> 1.  Initialize random number generator with seed.  The
>       seed should be at least 5 digits according to the
>       package comments to ensure randomness.
>
>         Example:
>
>           SQL> exec dbms_random.initialize (12345);
>
>                PL/SQL procedure successfully completed.
>
>   2.   Generate random number.
>
>        Example 1:
>
>           SQL> set serveroutput on
>
>            SQL> declare
>               2 random_number binary_integer;
>               3 begin
>               4 random_number := dbms_random.random;
>               5 dbms_output.put_line(to_char(random_number));
>               6 end;
>               7  /
>
>                2116177396
>
>           PL/SQL procedure successfully completed.
>
>         Example 2: (from Oracle Cryptographic Toolkit
>                    Programmer's Guide Rel 2.0.4)
>
>            DECLARE
>                i BINARY_INTEGER;
>               BEGIN
>                dbms_random.initialize(19254);
>                i := dbms_random.random;
>                INSERT INTO some_table VALUES(i);
>               dbms_random.terminate;
>            END;
>
>   3. Terminate the random number generator to release memory.
>
>         Example:
>
>            SQL> exec dbms_random.terminate;
>
>            PL/SQL procedure successfully completed.
>
>   4. Change the random number generator seed after initial
>      initialization.
>
>         Example:
>
>            SQL> exec dbms_random.seed (12346);
>
>            PL/SQL procedure successfully completed.
>
>   5. Warnings
>
>         If dbms_random.terminate has been executed after
>         dbms_random.random was successful, then subsequent
>         executions of dbms_random.random may return neither
>         a result or an error.  If dbms_random.random is run
>         before executing dbms_random.initialize then an
>         exception will be raise and "ORA-06510: PL/SQL:
>         unhandled user-defined exception results if the
>         exception is not handled in the pl/sql block.  It is
>         not currently possible to use the return value of the
>         random function directly in a SQL statement.
>
>         Example:
>
>            SQL> exec dbms_random.initialize (12345);
>
>            PL/SQL procedure successfully completed.
>
>            SQL> insert into x values(dbms_random.random);
>                 insert into x values(dbms_random.random)
>                         *
>                 ERROR at line 1:
>                 ORA-06571: Function RANDOM does not guarantee
>                            not to update the database.
>
> Regards
>
> "The Views expressed here are my own and not necessarily those of Oracle
> Corporation"
>
> S Schaber <sschaber@yahoo.com> wrote in message
> news:37D6A602.BD6E7A9@yahoo.com...
> >
> > Env: Oracle 8.0.5.1 on solaris
> >
> > I'm trying to use dbms_crypto_toolkit package
> > to encrypt strings. It gives this error:
> >
> > declare
> > *
> > ERROR at line 1:
> > ORA-06550: line 10, column 11:
> > PLS-00307: too many declarations of 'ENCRYPT' match this call
> > ORA-06550: line 10, column 3:
> > PL/SQL: Statement ignored
> >
> > My code is:
> >
> > declare
> >   ps dbms_crypto_toolkit.Persona := null;
> >   i number;
> >   str1 varchar2(1000);
> > begin
> >   dbms_crypto_toolkit.Initialize;
> >   dbms_crypto_toolkit.CreatePersona(dbms_crypto_toolkit.MD5,
> >     null, 'aaa', 'aaa', 'aaa', ps);
> >   str1 := 'aaa';
> >   str1 := dbms_crypto_toolkit.Encrypt(ps, str1);
> >   dbms_crypto_toolkit.Terminate;
> >
> > end;
> > /
> >
> >

