Algorithm for name generation

19

I researched a lot but did not find an algorithm that does something like banks do. For example, when you register for the first time in a 24-hour box, the machine generates a password. In general, 3 or 4 letter pairs are entered as a password.

However, if noted, the letters they automatically generate make some sense if they are read as a word.

Example:

CE THE LU / XE GO U

Is there anything I know that will accomplish what I want?

Thank you!

    
asked by anonymous 11.09.2014 / 11:56

1 answer

17

I did an algorithm of this in 2008. It ran in PHP. I called it "pronounceable password"

The initial idea was like @Motta's comment. Two lists: one of consonants and one of vowels:

ListaConsoantes = b c d f g j k l m n p r s t v x
ListaVogais = a e i o u

I have been improving the consonants and vowels to form more complex words:

ListaConsoantes  = b c d f g j k l m n p r s t v x 
ListaConsoantes2 = ch qu gu lh 
ListaConsoantesFim = s x r l m
ListaVogais      = a e i o u y 
ListaVogais2     = au ei oa ya

The function received the number of characters for the password to be generated, but this number was intended as a minimum for the algorithm to be able to complete the word, not to stop in the middle of a syllable.

These phonemes can be expanded and scrambled as desired.

The algorithm looks like this (in pseudocode):

size = 8
senha = ''
if ( rand entre 0 ou 1 )
    // inicio com uma vogal simples ou não da ListaVogais [1]
    senha = ListaVogais[ rand ]
while senha.size < size
     // sorteio se uso uma consoante de ListaConsoantes ou ListaConsoantes2 [2]
     if ( rand entre 0 ou 1 )
         senha = senha + ListaConsoantes[ rand ]
     else
         senha = senha + ListaConsoantes2[ rand ]

     // sorteio se uso uma vogal de ListaVogais ou ListaVogais2 [3]
     if ( rand entre 0 ou 1 )
         senha = senha + ListaVogais[ rand ]
     else
         senha = senha + ListaVogais2[ rand ]

     // sorteio se uso uma consoante no fim da palavra [4]
     if ( rand entre 0 ou 1 )
         senha = senha + ListaConsoantesFim[ rand ]

Exit, a nice passwords.

could exit due to [1]:

  

baquichoba or Abaquichoba

could exit due to [2]:

  

baquichoba or baDichoba

could exit due to [3]:

  

badOchoba or badAUchoba

could exit due to [4]:

  

Banichoba or BanichobaS

    
11.09.2014 / 15:28