xcoder
Member in Training
Posts: 56
|
Post by xcoder on Dec 9, 2021 21:01:06 GMT
print "#########################" A$(1) = "Johnny" A$(2) = "Jimmy" A$(3) = "Batman" hashVal(1) = 909810036 hashVal(2) = 1302095208 hashVal(3) = 965870456 '-------------------------------------------- hashed passwords are alpha,bravo,charlie [repeat] input "Enter user name: ";user$ max = 5 for i = 1 to max if A$(i) = user$ then print "found in index ";i 'last index before exit loop print i,A$(i),hashVal(i) exit for end if next
input "Enter password: ";pwd$ hash = hashIt(pwd$) if hash = hashVal(i) then 'last index before exit print "User name and password valid" else print "Invalid User name and password" end if print "Now add your user name and password to data Base" input "Enter your user name: ";user$ for i = 1 to max if A$(i) = "" then A$(i) = user$ exit for end if next input "Enter your password: ";pwd$ hash = hashIt(pwd$) hashVal(i) = hash 'last index before exit for if i = max then call dBaseFull '******* for i = 1 to max print i,A$(i),hashVal(i) next goto [repeat] print:print print "End of Code" End
function hashIt(pwd$) for i = 1 to len(pwd$) byte = byte xor (asc(mid$(pwd$,i,1))* 33^10)mod 2^32 next hashIt = byte end function
sub dBaseFull print "Data Base is full" Stop end sub
|
|