| « Prev | Page 1 | Page 2 | Next » |
|
|
First to say First.
|
You had to remind me of her didn't you. After she had my baby and ran off with Mr. Viagra I haven't seen her since. |
|
Leper! Outcast! Unclean!
However, as a WTF this one really isn't so awful. GeneratePassword uses decent randomness, and stripping out non-alphas is OK for a URL. |
|
I see the WTF, they should have used a regexp.
|
|
Just make a char[] and fill it with random numbers between 'a' and 'z', return it with the string constructor.
|
Re: Securely Random Strings
2012-04-12 09:26
•
by
the beholder
(unregistered)
|
I can't find any numbers between 'a' and 'z'. Now what? |
Re: Securely Random Strings
2012-04-12 09:34
•
by
trtrwtf
(unregistered)
|
What have you done with 98? |
|
Random? Check.
Clean? Oh ... Nothing to do with Shanghai girls, then ... |
|
Is the WTF that he returns an "uncleanRandomString" instead of a clean one?
|
|
Why not just use /dev/random?
That's what it's there for. |
Re: Securely Random Strings
2012-04-12 09:45
•
by
Your Mom's FIshtank
(unregistered)
|
|
When selecting trim, randomness is the most desired trait. Cleanliness is the second.
|
|
The idea is not so horrible. Chances are low, but this definitely increased the possibility of generating two identical random strings.
But you weren't looking for ASCII conversion, you were looking for HttpServerUtility.UrlEncode(str), isn't it? |
You aren't looking hard enough. This may require a special keyboard. You may have to spell the numbers out. Be a problem solver man. |
|
protected String getRanString()
{ // Random string generated by a fair pick of scrabble letters for a bag return "Brillant"; } |
Re: Securely Random Strings
2012-04-12 09:50
•
by
Anon
(unregistered)
|
What?!? Don't you remember the song:
|
Re: Securely Random Strings
2012-04-12 09:56
•
by
sagaciter
(unregistered)
|
But 'a' and 'z' ARE numbers... #include <stdio.h> |
|
public static string GeneratePassword (int length, int numberOfNonAlphanumericCharacters)
protected String getRanString() { return GeneratePassword(10,0); } The remaining code is useless because the 2nd argument asks for zero punctuation characters. |
|
Noone's posted "Frist" as parsed by that encoder?
I am disappoint. |
Re: Securely Random Strings
2012-04-12 10:06
•
by
atk
(unregistered)
|
*woosh* <-- joke O \|/ | <-- you / \ |
There is no "s" on that list. I suppose 1 could go "}]^-?" |
Re: Securely Random Strings
2012-04-12 10:12
•
by
Roby McAndrew
|
|
I can see 'i' and 'e', but then I'm irrational
|
|
Wondering how the creator of this mess decided on which characters to substitute for the "bad" chars. "a" appears twice, there are some letters and some numbers. It would seem that the easiest options are to either replace everything with the same letter, or replace !->a, @->b, #->c, etc.
Why do I have the sneaking suspicion that he ran GeneratePassword and hand-selected the alphanumerics to use as the substitute in order to be "more randomer"? |
Re: Securely Random Strings
2012-04-12 10:43
•
by
sagaciter
(unregistered)
|
|
You mean he meant that the original creator of that code probably didn't know that?
Well, that was funny. |
Re: Securely Random Strings
2012-04-12 10:50
•
by
wonk
(unregistered)
|
And imaginative. |
Re: Securely Random Strings
2012-04-12 11:03
•
by
Hmmmm
(unregistered)
|
Assuming what someone else said is true then most definitely not or he would have realised that no non-alphnumerics were getting generated anyway... |
Re: Securely Random Strings
2012-04-12 11:08
•
by
Hmmmm
(unregistered)
|
FTFM |
|
obligatory xkcd:
http://xkcd.com/221/ |
Re: Securely Random Strings
2012-04-12 11:31
•
by
Anon
(unregistered)
|
^^ is correct. I misunderstood/misread the MSDN documentation. |
Re: Securely Random Strings
2012-04-12 11:50
•
by
wibble factory
(unregistered)
|
from http://msdn.microsoft.com/en-us/library/system.web.security.membership.generatepassword.aspx public static string GeneratePassword( int length, int numberOfNonAlphanumericCharacters ) ...even though it's specified in the docs that it's the minimum number of the alpha chars (not the actual) it's totally lame that the second parameter is called 'numberOfNonAlphanumericCharacters' and not 'minimumNumberOfNonAlphanumericCharacters' (or some shorter equivalent) |
|
Guids, man. Pork of the future.
|
|
"System.Web.Security.Membership.GeneratePassword"? Ugh. You think they could cram a few more levels of hierarchical namespacing into that if they tried? Just in case 5 isn't ugly enough for someone out there?
|
Re: Securely Random Strings
2012-04-12 12:37
•
by
troll2
(unregistered)
|
ACK and you say receive: System.Web.Application.Security.Membership.User.Account.Password.GeneratePassword |
Translate to Hebrew. But your rabbi is out of town. Now what do you do? |
Re: Securely Random Strings
2012-04-12 12:54
•
by
Joe
(unregistered)
|
Com.Innotech.corporation.We.Build.The.Future.TM.System.Web.Application.Security.Membership.User.Account.Password.GeneratePassword |
Re: Securely Random Strings
2012-04-12 13:02
•
by
Joe
(unregistered)
|
You need to use a different keyboard layout. qwerty or azerty won't work. Try dvorak. |
|
Code Challenge:
The shortest legible password generator that considers the following: - Alpha only, or alpha numeric, or alpha-num + symbols - Miminum and maximum length can be specified - Minimum/maximum length of any group (alpha, num etc.) can be specified. - Sufficiently random Bonus points: - No dictionary words from lang of choice - Uniformly distributed over possible set of characters And.... GO |
|
#!/usr/bin/perl
sub GenPW{print "Go ask your mom\n";} 1; |
Re: Securely Random Strings
2012-04-12 13:18
•
by
RandomGuy
(unregistered)
|
First thing that came to my mind as well ... |
|
What? Didn't he know you should do it all in one line?
String uncleanRandomString = System.Web.Security.Membership.GeneratePassword(10, 0).Replace("!", "a").Replace("@", "2").Replace("#", "c").Replace("$", "4").Replace("%", "3").Replace("^", "i").Replace("&", "a").Replace("*", "9").Replace("(", "g").Replace(")", "m").Replace("_", "d").Replace("-", "5").Replace("+", "p").Replace("=", "q").Replace("[", "w").Replace("{", "t").Replace("]", "r").Replace("}", "f").Replace(";", "8").Replace(":", "z").Replace("<", "x").Replace(">", "0").Replace("|", "v").Replace(".", "b").Replace("/", "y").Replace("?", "t");
|
There are no numbers between a and z on a dvorak keyboard. Just 'aoeuidhtns-' on the home row and 'zvwmbxkjq;' (right to left) on the bottom one. The closest you get is a dash or a semicolon. |
|
There are plenty of numbers between 'a' and 'z':
perl -e '$X="a";while ($X le "z"){print $X++;}' abcdefghijklmnopqrstuvwxyz |
Re: Securely Random Strings
2012-04-12 13:51
•
by
Sea Sharp, Waves Hurt
(unregistered)
|
Thomas Covenant. Classy :). |
|
Ran string is string that constantly runs through memory invalidating its pointer.
|
This is why I come to this forum. Nicely done! |
|
At least the implementation is encapsulated in its own method and can easily be refactored. That's of far more value than the WTFish implementation.
|
Re: Securely Random Strings
2012-04-12 14:42
•
by
Jay
(unregistered)
|
I see i, v, x, l, c, d, and m. You're not limiting yourself to those new-fangled Hindu-Arabic numerals, are you? They're just a passing fad. |
Re: Securely Random Strings
2012-04-12 14:45
•
by
Jay
(unregistered)
|
Very witty, sir. But I just have to be pedantic and point out that "i" is not irrational: it is imaginary. "Not rational" is not the same as "irrational". |
I'll add pendantary to your pendantary. He did not say the numbers were irrational, only that he was, for picking non-rational numbers. |
Re: Securely Random Strings
2012-04-12 16:25
•
by
Zunetang
(unregistered)
|
Ah, wait! He didn't say he picked them because he was irrational, even though he may have implied it. |
| « Prev | Page 1 | Page 2 | Next » |