Hi all,

I had an idea the other day for a password system that did not store passwords, but generated them on the fly. It uses the PRNG (Pseudo Random Number Generator) in KiX to create a seemingly random looking string according to:

1. Case sensitive Username
2. A key like Month Number that changes on a regular basis. This could be either a global key that effects all passwords, or a local one for a particular username.

How it works:

When you run KAPgen, it SEEDs the PRNG with the seconds from the current system time. This gives us 1 of 60 possible RNG starting points. From this, 2 numbers are generated, these are the KAP seed. You can set this higher if you like.

These form the first two chars of the password.

Next we pick a random letter from the username and run RND(0) the number of times of ASC(that letter). So, if the letter was "A" then we run RND(0) 65 times. If it was "a" then we run it 97 times - case sensitive...

Now we get a random letter or number from the :RNG routine. This firstly gets a random number from 0..2 and then returns $iRND in the range of 48..57, 65..90, 97..122 for 0..2 respectively.

CHR($iRND) is the next letter of our password.

This is repeated until we have a password $iLength chars long. This is a complicated enough system that no human with a hex calculator should be able to work it out.

This is not meant to be a hacker proof system and I wouldn't use it in an environment with unix programmers with spare time But, it is a system that does not require a repository of passwords.

To Decode:

Run KAPcheck and enter the username and password. You will get a Passed!($iPassed=1) or Failed!($iPassed=0).

enjoy

cj

KAPgen.KiX

code:

break on
cls
;
; KAPgen
;
; v 1.0
;
; by cj
;
; KiX Algorithmic Password Generator
; This creates an AP from a username
;
; Use KAPcheck to authenticate user
;


"KAPgen V1.0" ? ?
while $sUsername="" "Username: " gets $sUsername ? loop ; username
while $iLength=0 "Length: " gets $iLength ? loop $iLength=val($iLength) ; password length including the seeds
$iKey=@monthno ; your ever-changing key, currently Month Number


;--------------------------------------------------------------- the line
; vars
$iSeedCount=2 ; number of seeds
$sPassword="" ; password string
$iSeed=0 ; seed for password


; seed prng
srnd(val(substr(@time, 7, 2)))
"Generating KAP for $sUsername: ."


; create KAP seeds
$i=0
do
gosub rng
if $iSeed=0 $iSeed=$iRND
else $iSeed=$iSeed*$iRND endif ; get number
$sPassword=$sPassword+chr($iRND) ; get character
$i=$i+1
until $i=$iSeedCount


; seed KAPgen
srnd($iSeed * $iKey)


; generate other chars
$i=0
do
$k=rnd(len("$sUsername")-1) $j=0 do $=rnd(0) $j=$j+1 until $j=asc(substr($sUsername, $k+1, 1))+1
gosub rng
$sPassword=$sPassword+chr($iRND)
$i=$i+1
until $i=$iLength-$iSeedCount


; display password
? ? "KAP = $sPassword" ?


; quit program
quit


; Random Number Generator
:rng
$x=rnd(2)
select
case $x=0 $iRND=rnd(9)+48 ; 0..9
case $x=1 $iRND=rnd(25)+65 ; A..Z
case $x=2 $iRND=rnd(25)+97 ; a..z
case 1 ; this is here because I found a bug in KiX!
endSelect
"."
return


and

KAPcheck.KiX

code:

break on
cls
;
; KAPcheck
;
; v 1.0
;
; by cj
;
; KiX Algorithmic Password Checker
; This authenticates an AP from a username
;
; Use KAPgen to generate AP
;


"KAPcheck V1.0" ? ?
while $sUsername="" "Username: " gets $sUsername ? loop ; username
while $sPassword="" "Password: " gets $sPassword ? loop ; KAP from KAPgen
$iKey=@monthno ; your ever-changing key, currently Month Number


;--------------------------------------------------------------- the line
; vars
$iSeedCount=2 ; number of seeds
$sCheck="" ; password checking string
global $iPassed ; passed or failed

; seed KAPcheck PRNG
$iSeed=asc(substr($sPassword, 1, 1)) ; seed for password
$i=1 do $iSeed=$iSeed*asc(substr($sPassword, $i+1, 1)) $i=$i+1 until $i=$iSeedCount
srnd($iSeed * $iKey)
"Checking KAP for $sUsername: ."


; generate other chars
$i=0
do
$k=rnd(len("$sUsername")-1) $j=0 do $=rnd(0) $j=$j+1 until $j=asc(substr($sUsername, $k+1, 1))+1
gosub rng
$sCheck=$sCheck+chr($iRND)
$i=$i+1
until $i=len("$sPassword")-$iSeedCount


; display check
if $sCheck=substr($sPassword, $iSeedCount+1, len("$sPassword")-$iSeedCount)
color g+/n " Passed!" $iPassed=1
else
color r+/n " Failed!" $iPassed=0
endif
color w/n ?


; quit program
quit


; Random Number Generator
:rng
$x=rnd(2)
select
case $x=0 $iRND=rnd(9)+48 ; 0..9
case $x=1 $iRND=rnd(25)+65 ; A..Z
case $x=2 $iRND=rnd(25)+97 ; a..z
case 1 ; this is here because I found a bug in KiX!
endSelect
"."
return


------------------

Goto my website for more scripts. Just click the hammer and spanner icon.

chrismat@ozemail.com.au