Phonetically Memorable Password Generation Algorithms

后端 未结 17 2284
生来不讨喜
生来不讨喜 2021-01-30 00:05

Background

While at the Gym the other day, I was working with my combination lock, and realized something that would be useful to me as a programmer. To wit, my combin

17条回答
  •  感情败类
    2021-01-30 00:45

    I have a few times used a following algorithm:

    1. Put all lowercase vowels (from a-z) into an array Vowels
    2. Put all lowercase consonants (from a-z) into another array Consonants
    3. Create a third array Pairs of two letters in such a way, that you create all possible pairs of letters between Vowels and Consonants ("ab", "ba", "ac", etc...)
    4. Randomly pick 3-5 elements from Pairs and concatenate them together as string Password
    5. Randomly pick true or false
      1. If true, remove the last letter from Password
      2. If false, don't do anything
    6. Substitute 2-4 randomly chosen characters in Password with its uppercase equivalent
    7. Substitute 2-4 randomly chosen characters in Password with a randomly chosen integer 0-9

    Voilá - now you should have a password of length between 5 and 10 characters, with upper and lower case alphanumeric characters. Having vowels and consonants take turns frequently make them semi-pronounceable and thus easier to remember.

提交回复
热议问题