31
4
Your challenge is to passwordify the string! What is passwordifying, you ask?
Take a string as input. This string will only contain uppercase letters, lowercase letters, digits, and spaces.
You must replace all spaces with underscores and move all numbers to the end of the string in the order that they appear from left to right. Then, for every letter in the string, randomly change it to uppercase or lowercase.
Examples (case of characters should vary every time):
Input
Hello world
Output
HElLo_wORld
Input
pa55 w0rd
Output
pA_Wrd550
Input
14 35
Output
_1435
Input
0971
Output
0971
Input
[space]
Output
_
Shortest code in bytes wins!
Whoever asks on Information Security SE if this is a good hashing algorithm wins!--Don't worry SE overlords, I'm just kidding.
47Great. Now you've published my scheme. Be right back, changing all my passwords... – Geobits – 2016-03-29T17:35:59.840
8It's not even a password hashing algorithm... it would be killed with fire on Security SE XD – Justin – 2016-03-29T18:08:31.807
1If only there was an easy way to do randomness in Retina... – mbomb007 – 2016-03-29T18:30:26.273
1I honestly wonder if someone were to post the most obfuscated of these answers if Security.SE would even be able to figure out what it was doing to shame it. – CAD97 – 2016-03-29T18:35:32.213
4This is not a good hashing algo because it's randomized – CalculatorFeline – 2016-03-29T19:57:45.670
If only there was a way to do randomness in Retina... – CalculatorFeline – 2016-03-29T20:01:04.553
6I'm tempted to use some of the answers as a password – MickyT – 2016-03-29T23:34:52.320
Full program or function? – HyperNeutrino – 2016-03-30T00:59:52.657
@AlexL. I think that either works. I didn't specify before, and I'm not sure yet if some people answered with full programs or functions, so I do not want to nullify any answers unfairly. – Daniel – 2016-03-30T01:02:38.823
@Dopapp Okay. Thanks. – HyperNeutrino – 2016-03-30T01:05:23.080
May I suggest changing the title to "Tr0ub4dor&3-ize the string"? Because of the popularity of the comic, a method of creating passwords similar to this is sometimes known as the "troubador method," and I suspect most who frequent StackExchange will understand the reference immediately.
– jpmc26 – 2016-04-01T01:02:47.650@Dopapp I appreciate the thought of acceptance, but I don't think my answer's the shortest :P – Sp3000 – 2016-04-11T03:05:09.747
@Sp3000, well great answer anyway and a +1 from me – Daniel – 2016-04-11T03:07:03.847