#Help Joe Bloggs with his password hash#
Help Joe Bloggs with his password hash
Joe was confidently using "password1" as his main password to all his accounts until one day he received an e-mail from fBay. His account has been compromised and he must change his password immediately. Yet worse, the attacker had access to all Joe's accounts. Being an engineer, Joe thought: What if I could hash somehow my password using a keyword? I wouldn't need to remember any passwords and I would have a different one for each account.
Joe then creates an algorithm - he takes the domain name as a key and creates the password for each of his account consisting of:
1. (<consonants><vowels>)(alternating case: lower, capital, lower...)
2. <number of consonants><number of vowels>
3. <sum of consonants and vowels numbers converted to a character on US Qwerty Keyboard>
Joe then opens an account on SO to create a new code golf challenge. He uses stackoverflow
as a key to generate password:
1. sTcKvRfLwAoEo - consonants and vowels in alternating case
2. 94 - 9 consonants, 4 vowels
3. 9+4=13, 1+3=4, Shift+4=$
Therefore, Joe's password for stackoverflow is: sTcKvRfLwAoEo94$
Challenge
Create a shortest function to generate a password given the rules above. The code should accept a string type parameter d
and return/display the generated password.
Rules
- Only Latin letters from the input should be used. Any other characters should be ignored.
- Minimum input length is 1 letter. (guys at q.com need passwords as well!)
- Assume Y is a vowel
- If vowels or consonants are missing, use
0
accordingly. E.g. inputa
would result ina01!
- Shortest code wins