PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: Mr.T on 21 August, 2007, 16:24:35

Title: password generator
Post by: Mr.T on 21 August, 2007, 16:24:35
is it possible to make a script that makes password for users i have thinking to change password for all users every year
for password i wood like to have it like this 8 characters then the year like this    dhe45srt-2007  hope you now what i mean

:)
Title: Re: password generator
Post by: zero-cool on 21 August, 2007, 16:45:45
Here's random code
Generate = function(n)
local t,i,r,e1,e2,_
local s = ""
t = { "48-57","65-90","97-122"}
for i=1,n do
r = math.random(1,table.getn(t))
_,_,e1,e2 = string.find(t[r],"(%d+)%-(%d+)")
s = s..string.char(math.random(e1,e2))
end
return(s)
end

Use Generate(x), where x is the number of characters you want.

Best regards,
Title: Re: password generator
Post by: bastya_elvtars on 21 August, 2007, 17:40:30
Why not put ASCII ranges to an array inside the "big" array and unpack the "little" array after randomly choosing it from the "big" one?
math.random(unpack(arr))
Title: Re: password generator
Post by: zero-cool on 22 August, 2007, 02:46:13
local r = math.random(#t)
What does "#" means?
Title: Re: password generator
Post by: bastya_elvtars on 22 August, 2007, 02:54:23
#t is the number of elements in array t. It used to be table.getn(t)
Title: Re: password generator
Post by: zero-cool on 22 August, 2007, 02:59:28
Quote from: bastya_elvtars on 22 August, 2007, 02:54:23
#t is the number of elements in array t. It used to be table.getn(t)
Thanks  ;) ;)
Title: Re: password generator
Post by: bastya_elvtars on 22 August, 2007, 14:38:21
table.maxn gets the highest numerical index from "mixed" tables(e. g. {["a"]=b, "c","d"}) too. Of course this is achieved via iterating through the table, so it's really slow and should only be used when really necessary (that is, for tables like the one I posted above).
Title: Re: password generator
Post by: Mr.T on 22 August, 2007, 17:11:16
what i mean is if it's possible to make a script that gennerate password ex.
if you reg a user you go to this script an it makes a password for the user whit rigtclick that you can use to reg the user :)
Title: Re: password generator
Post by: Mr.T on 25 August, 2007, 11:53:26
can't find it  :)
can somebody post this script her cant find it Auto-Pass 1.0 LUA 5.0/5.1
:)
Title: Re: password generator
Post by: Thor on 25 August, 2007, 12:19:45
Google is for us: http://lua.uknnet.com/thread.php?threadid=1878&sid=0270f31d0cbd58856b6f71f888112bfa
Title: Re: password generator
Post by: Mr.T on 25 August, 2007, 13:16:41
thanks :)