You Asked
Hello Tom,
here I have created a table as shown below,can you please
give me a procedure for the auto system generation of password
and want to know the probabality of that password being occured.
CREATE TABLE USER_INFO
(Title varchar2(9),
First_Name Varchar2(30),
Last_Name Varchar2(30),
Sex Varchar2(7) check (sex in('MALE', 'FEMALE')),
Date_Of_Birth Date,
Age Number(2),
Address1 Varchar2(60),
Address2 Varchar2(55),
Address3 Varchar2(55),
City Varchar2(30),
PIN_ZIP Number(8),
State Varchar2(35),
Country Varchar2(50),
Phone_Home Number(12),
Phone_Work Number(12),
e_Mail_ID Varchar2(75),
PKN Varchar2(25) Primary Key,
COMPUTER_STATUS VARCH(8),check (COMPUTER_STATUS
in('Y', 'N')));
and Tom said...
I use the following routine to generate random passwords for people:
create or replace function generate_password (
in_userid in varchar2, l_date in date
)
return varchar2
is
j number := 0;
k number;
str varchar2(30);
result varchar2(30);
begin
if in_userid is null then
return null;
end if;
str := substr (in_userid, 1, 4) || to_char (l_date, 'SSSS');
for i in 1 .. least (length (str), 8)
loop
j := mod (j + ascii (substr (str, i, 1)), 256);
k := mod (bitand (j, ascii (substr (str, i, 1))), 74) + 48;
if k between 58 and 64 then
k := k + 7;
elsif k between 91 and 96 then
k := k + 6;
end if;
result := result || chr (k);
end loop;
result := replace (result, '1', '2');
result := replace (result, 'l', 'L');
result := replace (result, '0', '9');
result := replace (result, 'O', 'P');
result := 'A' || substr (result, 2);
return result;
end generate_password;
/
You'd have to have the same first 4 digits and do it at the same time of day to get a dup.
Rating
(13 ratings)
Is this answer out of date? If it is, please let us know via a Comment