ENCRYPTED PASSWORD PROCEDURE
CREATE OR REPLACE PROCEDURE proc_create_password (
userid VARCHAR2,
passwd VARCHAR2,
encpass OUT VARCHAR2
) IS
var1 NUMBER;
var2 NUMBER;
var3 NUMBER;
var4 NUMBER;
var5 NUMBER;
var55 NUMBER;
var6 NUMBER;
var7 NUMBER;
var8 NUMBER;
var9 NUMBER;
var10 NUMBER;
var66 NUMBER;
mul1 NUMBER;
mul2 NUMBER;
mul3 NUMBER;
mul4 NUMBER;
mul5 NUMBER;
mul6 NUMBER;
mulfin VARCHAR2 (30);
mullen NUMBER;
loopfor NUMBER;
STORE VARCHAR2 (30);
ctr NUMBER;
i NUMBER;
subs NUMBER;
BEGIN
IF NVL (LENGTH (userid), 0) < 6 OR NVL (LENGTH (passwd), 0) < 6 THEN
raise_application_error
(-20004,
'Length of Userid /Password should be 6 Characters long '
);
END IF;
var1 := ASCII (SUBSTR (userid, 1, 1));
var2 := ASCII (SUBSTR (userid, 2, 1));
var3 := ASCII (SUBSTR (userid, 3, 1));
var4 := ASCII (SUBSTR (userid, 4, 1));
var5 := ASCII (SUBSTR (userid, 5, 1));
var55 := ASCII (SUBSTR (userid, 6, 1));
/** position multiplication ***/
var2 := var2 * 2;
var3 := var3 * 3;
var4 := var4 * 4;
var5 := var5 * 5;
var55 := var55 * 1;
var6 := ASCII (SUBSTR (passwd, 1, 1));
var7 := ASCII (SUBSTR (passwd, 2, 1));
var8 := ASCII (SUBSTR (passwd, 3, 1));
var9 := ASCII (SUBSTR (passwd, 4, 1));
var10 := ASCII (SUBSTR (passwd, 5, 1));
var66 := ASCII (SUBSTR (passwd, 6, 1));
/** position multiplication ***/
var7 := var7 * 2;
var8 := var8 * 3;
var9 := var9 * 4;
var10 := var10 * 5;
var66 := var66 * 1;
/* Cross Multiplication */
mul1 := var1 * var10;
mul2 := var2 * var9;
mul3 := var3 * var8;
mul4 := var4 * var7;
mul5 := var5 * var6;
mul6 := var55 * var66;
mulfin :=
TO_CHAR (mul1)
|| TO_CHAR (mul2)
|| TO_CHAR (mul3)
|| TO_CHAR (mul4)
|| TO_CHAR (mul5)
|| TO_CHAR (mul6);
mullen := NVL (LENGTH (mulfin), 0);
IF MOD (mullen, 3) != 0 THEN
loopfor := (FLOOR (mullen / 3)) + 1;
ELSE
loopfor := (mullen / 2);
END IF;
ctr := 1;
i := 1;
LOOP
subs := SUBSTR (mulfin, i, 2);
IF subs NOT BETWEEN 48 AND 57 THEN
IF subs > 90 THEN
LOOP
subs := subs - 26;
EXIT WHEN subs < 91;
END LOOP;
END IF;
IF subs < 65 THEN
LOOP
subs := subs + 26;
EXIT WHEN subs > 64;
END LOOP;
END IF;
END IF;
STORE := STORE || CHR (subs);
EXIT WHEN ctr = loopfor;
ctr := ctr + 1;
i := i + 3;
END LOOP;
encpass := STORE;
END;
/
CREATE OR REPLACE PROCEDURE proc_create_password_long (
userid VARCHAR2,
passwd VARCHAR2,
encpass OUT VARCHAR2
) IS
var1 NUMBER;
var2 NUMBER;
mul1 NUMBER;
mulfin VARCHAR2 (120);
mullen NUMBER;
loopfor NUMBER;
STORE VARCHAR2 (120);
ctr NUMBER;
i NUMBER;
subs NUMBER;
BEGIN
var1 := 1;
var2 := 1;
IF NVL (LENGTH (userid), 0) > 20 OR NVL (LENGTH (passwd), 0) > 8 THEN
raise_application_error
(-20004,
' Length of Userid /Password should be 20/8 Characters long '
);
END IF;
FOR j IN 1 .. LENGTH (userid) LOOP
var1 := ASCII (SUBSTR (userid, j, 1));
var2 := ASCII (SUBSTR (passwd, LENGTH (passwd) - j + 1, 1));
mul1 := var1 * var2;
mulfin := mulfin || TO_CHAR (mul1);
END LOOP;
mullen := NVL (LENGTH (mulfin), 0);
IF MOD (mullen, 3) != 0 THEN
loopfor := (FLOOR (mullen / 3)) + 1;
ELSE
loopfor := (mullen / 2);
END IF;
ctr := 1;
i := 1;
LOOP
subs := SUBSTR (mulfin, i, 2);
IF subs NOT BETWEEN 48 AND 57 THEN
IF subs > 90 THEN
LOOP
subs := subs - 26;
EXIT WHEN subs < 91;
END LOOP;
END IF;
IF subs < 65 THEN
LOOP
subs := subs + 26;
EXIT WHEN subs > 64;
END LOOP;
END IF;
END IF;
STORE := STORE || CHR (subs);
EXIT WHEN ctr = loopfor;
ctr := ctr + 1;
i := i + 3;
END LOOP;
encpass := STORE;
END;
/
Halim, a Georgia Tech graduate Senior Database Engineer/Data Architect based in Atlanta, USA, is an Oracle OCP DBA and Developer, Certified Cloud Architect Professional, and OCI Autonomous Database Specialist. With extensive expertise in database design, configuration, tuning, capacity planning, RAC, DG, scripting, Python, APEX, and PL/SQL, he combines technical mastery with a passion for innovation. Notably, Halim secured 16th place worldwide in PL/SQL Challenge Cup Playoff on the year 2010.
Friday, September 11, 2009
Subscribe to:
Post Comments (Atom)
My Blog List
-
-
-
ASSM states3 weeks ago
-
UKOUG Discover 20241 month ago
-
-
-
-
-
-
-
-
Moving Sideways8 years ago
-
-
Upcoming Events...11 years ago
-
No comments:
Post a Comment