A random password generator [message #4955] |
Wed, 22 January 2003 08:27 |
xander
Messages: 9 Registered: December 2001
|
Junior Member |
|
|
Does anyone have an example of a procedure that creates
a random password for a user in pl/sql. I'm just looking for some ideas. perhaps the user name and a random 4 digit number or combining user name and todays date and then I would just encrypt. I'm not worrying about encrupt yet ...just the password generator. Thanks
|
|
|
|
Re: A random password generator [message #4965 is a reply to message #4955] |
Wed, 22 January 2003 11:26 |
Art Metzer
Messages: 2480 Registered: December 2002
|
Senior Member |
|
|
SQL> CREATE OR REPLACE FUNCTION generate_string_1
2 RETURN VARCHAR2
3 IS
4 l_string VARCHAR2(35);
5 BEGIN
6 SELECT vs.username
7 || TO_CHAR(MOD(ABS(DBMS_RANDOM.RANDOM),10000),'fm0000')
8 INTO l_string
9 FROM v$session vs
10 WHERE vs.audsid = USERENV('SESSIONID');
11
12 RETURN (l_string);
13 END generate_string_1;
14 /
Function created.
SQL> CREATE OR REPLACE FUNCTION generate_string_2
2 RETURN VARCHAR2
3 IS
4 l_string VARCHAR2(35);
5 BEGIN
6 SELECT vs.username
7 || TO_CHAR(SYSDATE,'YYYYMMDD')
8 INTO l_string
9 FROM v$session vs
10 WHERE vs.audsid = USERENV('SESSIONID');
11
12 RETURN (l_string);
13 END generate_string_2;
14 /
Function created.
SQL> SELECT generate_string_1 FROM DUAL;
GENERATE_STRING_1
-------------------------------------------------------
AMETZER<b>2264</b>
SQL> SELECT generate_string_1 FROM DUAL;
GENERATE_STRING_1
-------------------------------------------------------
AMETZER<b>0878</b>
SQL> SELECT generate_string_2 FROM DUAL;
GENERATE_STRING_2
-------------------------------------------------------
AMETZER20030122
SQL> A
|
|
|
|
|
Encryption on password...help? [message #4971 is a reply to message #4967] |
Wed, 22 January 2003 13:13 |
xander
Messages: 9 Registered: December 2001
|
Junior Member |
|
|
It helped a bunch ...thanks again....
Now about encrupting...
what I did was
CREATE OR REPLACE Procedure pass_gen
(p_user in VARCHAR2,
o_pass out VARCHAR2)
is
BEGIN
select user_Id
|| TO_CHAR(SYSDATE,'YYYYMMDD')
into o_pass
from user_table
where user_Id = P_User
and Ref_co = not null
and edate is null;
END;
/
Now I want to encrypt the value in o_pass, the book im looking at is showing encrypting of source code which is not helpful. I am searching the net but encryting a password appears to be scarce code to fine (unless im searching it wrong)...
Can anyone offer help or insight?
|
|
|
Re: Encryption on password...help? [message #4972 is a reply to message #4967] |
Wed, 22 January 2003 13:25 |
Art Metzer
Messages: 2480 Registered: December 2002
|
Senior Member |
|
|
quote:
----------------------------------------------------------------------
Now I want to encrypt the value in o_pass, the book im looking at is showing encrypting of source code which is not helpful. I am searching the net but encryting a password appears to be scarce code to fine (unless im searching it wrong)...
Can anyone offer help or insight?
----------------------------------------------------------------------
See this discussion.
A
|
|
|
|