Page 1 of 1

Make Password, mkpasswd() a simple password generator.

Posted: Sat Jun 23, 2007 2:13 am
by Rescator
This password generator makes "easy" to remember passwords.
This code generate 8 character alphanumeric passwords.

By changing the startpos of the Mids() and maybe adding uppercase letters to the consts$ and vowels$ you can easily customize this code.

And as the code is so simple, you should have no issues adding a chars$ that has "_-.,&%#!" and similar if you love really complicated passwords.
Password length is not that hard to redo either.

This code is a verbatim PureBasic implementation of a earlier PHP code I made.

This code is hereby placed in the public domain, do with as you please!

Code: Select all

Procedure.s mkpasswd()
 Protected consts$,vowels$,numbers$,const$,vow$,num$,x.l
 consts$="bcdfghjklmnpqrstvwxyz"
 vowels$="aeiou"
 numbers$="0123456789"
 For x=0 To 2
  const$+Mid(consts$,Random(Len(consts$)-1)+1,1)
  vow$+Mid(vowels$,Random(Len(vowels$)-1)+1,1)
  num$+Mid(numbers$,Random(Len(numbers$)-1)+1,1)
 Next
 ProcedureReturn Mid(num$,3,1)+Mid(num$,1,1)+Mid(const$,1,1)+Mid(vow$,1,1)+Mid(const$,3,1)+Mid(const$,2,1)+Mid(vow$,2,1)+Mid(const$,3,1)
EndProcedure

Debug mkpasswd()