Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Mooey Cow
Jan 27, 2018

by Jeffrey of YOSPOS
Pillbug

dwazegek posted:

While it's true that variables can be captured in a generated type, you'd also have to be capturing hundreds of variables before the class ends up in multi-kb territory. Which means that you have hundreds of variables in method scope to capture in the first place, which seems to be the real problem.
Well that depends on how large your variables are. The other day I saw someone post an iterator function that essentially interpolated between two 4x4 matrices, which were value types. It was six lines or so, but if the matrices were of double precision, and the function written carelessly so it would also need to store a temporary matrix, that's at least 3*16*8 = 384 bytes.

I mostly use C# when writing for the Unity game engine, and they use iterators to implement coroutines, so while normally you'd keep iterators short, there it's pretty common to see functions that are hundreds of lines long doing some complicated game logic, interspersed with yields everywhere.

Not saying any of this is necessarily bad tho, but it has performance implications you need to keep in mind when writing those kinds of applications.

quote:

However, I do wonder if C# is the right tool for your job if you frequently run into that sort of issue. Math heavy stuff has never really been one of C#'s strengths.

I wish I had a choice in the matter, but see above :(

Unity also uses an ancient Mono compiler so until recently you couldn't even foreach on simple lists without generating garbage.

Adbot
ADBOT LOVES YOU

raminasi
Jan 25, 2005

a last drink with no ice
Well, there is a CLR language with compile-time generiticity :v: I assume it wouldn't work in Unity though.

canis minor
May 4, 2011

LOOK I AM A TURTLE posted:

Nice, this lets us get rid of even more entropy. I'll assume we have this keypad layout:
pre:
1 2 3
4 5 6
7 8 9
  0
With horizontal and vertical adjacency both disallowed we can now discard sequences with 12, 14, 21, 23, 25, 32, 36, etc. On average each digit is now adjacent to 2.5 other digits. This brings the number of permitted codes down to 2.66%.

But why stop here? We should obviously block direct diagonal adjacency as well. If we include diagonal adjacency we can almost completely eliminate the digit 5 from the list of valid codes, as it would then only be able to occur at the beginning or end of the code, and only next to a 0. If e.g. 15 and 07 are also considered adjacent we can bring the number of possible codes down to 0.52%.

Um... with both of the requirements, shouldn't the only possible combinations be variations of 135790? Which is 6! = 720 combinations out of 1000000 possible combinations for 6 digits (if we ditch both requirements), unless I've gotten my maths wrong.

With diagonal adjacency, I don't see any codes where both requirements are met (at least for that keypad layout)

edit: wait - is 137465 valid according to requirements?

edit edit: vvv yup, reread it and it made sense, ty

canis minor fucked around with this message at 15:19 on Jun 18, 2018

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
You're allowed to have numbers that are adjacent to other numbers. They just can't be adjacent to the immediately previous number.

162738 is fine.

TheresaJayne
Jul 1, 2011

Jabor posted:

You're allowed to have numbers that are adjacent to other numbers. They just can't be adjacent to the immediately previous number.

162738 is fine.

also 143685 is allowed its numerically adjacent not positional adjacent, so 01 12 23 34 45 56 67 78 89 and their inverses are not allowed
neither is repeating a digit anywhere in the pin

xtal
Jan 9, 2011

by Fluffdaddy
Password strength requirements (which cannot be called that for reasons explained in this sentence) strictly reduce entropy and therefore security

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

xtal posted:

Password strength requirements (which cannot be called that for reasons explained in this sentence) strictly reduce entropy and therefore security

You say that, but if we didn't have them then millions of people would be using "password" and "123456" as their passwords.

Of course, now they use "password!" and "abc123" instead. :negative:

canis minor
May 4, 2011

TooMuchAbstraction posted:

You say that, but if we didn't have them then millions of people would be using "password" and "123456" as their passwords.

Of course, now they use "password!" and "abc123" instead. :negative:

Trustno1!

CPColin
Sep 9, 2003

Big ol' smile.
Just came across this as I'm breaking up a long function so I can cover it with tests:

code:
public Bar getBar(Foo f) {
   String foo = f?.name
   Date fStart = f?.start
   Date fEnd = f?.end

   if (!f) { new Foo(foo, fStart, fEnd) }
   Bar b = new Bar(foo: f)

   ...
}
So never mind that the variable names are crummy (why f and foo and not foo and fooName?) and never mind that if f is null, we're definitely passing three null values to that Foo constructor, but we're not even storing the new instance, so that new Bar instance just gets a null value anyway!

Now I'm trying to do code paleontology to figure out what used to be here that made this make sense.

Edit: Also, this function is probably never passed a null value anyway. Whee!

CPColin fucked around with this message at 05:48 on Jun 20, 2018

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
The answer to “how can this code possibly work when <thing> happens” does turn out to be “the callers just know not to use it like that” quite a lot. It’s usually a symptom of a technical management problem: an important piece of code doesn’t handle an important case correctly, but nobody feels empowered to fix it, so instead they just work around it in code they own. Leave it to fester long enough and the code will have a bad reputation, as if its bugs are somehow deeper and more intractable than bugs everywhere else. that code grows a reputation for being buggy and untrustworthy. You get these half-baked partial rewrites and wrapper libraries and piles of basically similar workarounds building up everywhere it’s used. Just ugliness breeding ugliness.

ETA: now I think I’m talking about a pretty different class of problem than you actually posted, but whatever, I’ll leave this here.

xtal
Jan 9, 2011

by Fluffdaddy
https://en.wikipedia.org/wiki/Conway%27s_law

Nude
Nov 16, 2014

I have no idea what I'm doing.

TooMuchAbstraction posted:

You say that, but if we didn't have them then millions of people would be using "password" and "123456" as their passwords.

Of course, now they use "password!" and "abc123" instead. :negative:

I a lot of sites are now blocking "password" outright, in which case I suggest drowssap.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

TooMuchAbstraction posted:

You say that, but if we didn't have them then millions of people would be using "password" and "123456" as their passwords.

I think it's dumb and ultimately a net loss to reduce everyone's security in order to increase a few idiots' security.

VikingofRock
Aug 24, 2008




a hot gujju bhabhi posted:

I think it's dumb and ultimately a net loss to reduce everyone's security in order to increase a few idiots' security.

It's actually quite a few idiots.

e: That said, I'd rather just blacklist the 1000 most common passwords than have stupid rules like "no repeating characters".

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

VikingofRock posted:

It's actually quite a few idiots.

e: That said, I'd rather just blacklist the 1000 most common passwords than have stupid rules like "no repeating characters".

That data says that 10% of people used the worst 25 passwords. So you're lowering the security for 100% of your users in order to increase it for 10% who knowingly and deliberately lowered their own security (and by the way depending on the rules you introduce, you may not even be increasing it enough to offset the decrease, in which case you've achieved nothing at all for any of your users).

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
there is no way to have a password system based upon causation and not have that pareto rule

even the little puzzle lock things have a pareto rule of unlocking

biometrics have a fuckin inequality in false positives

it's not a whole bit of entropy if you do it right

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

bob dobbs is dead posted:

there is no way to have a password system based upon causation and not have that pareto rule

even the little puzzle lock things have a pareto rule of unlocking

biometrics have a fuckin inequality in false positives

it's not a whole bit of entropy if you do it right

Exactly, you're just changing the 25 most commonly used passwords, you're not removing the fact that there will exist 25 passwords that are the most common. What are those 25 passwords? Take the same list SplashData used, filter out only the passwords that match your arbitrary rules and get the top 25 from that.

You end up decreasing the overall set of possible passwords for no actual gain in security as far as I can tell.

putin is a cunt fucked around with this message at 06:35 on Jun 20, 2018

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:
Minimum password lengths reduce the total number of possible passwords, but people who are knowledgeable about passwords won't use short passwords anyway, so you're not reducing security by enforcing minimum lengths.

Mixing different character types is also generally a good thing, and people who are knowledgeable are going to do that anyway, so again, no reduction in security.

While it would be better if everyone in the world had a solid understanding of how to use passwords, that's also not reasonable to expect, so we use password rules to help those people.

It only becomes an issue when the people who come up with the rules make bad decisions that prevent good passwords from being chosen, but the solution to that problem isn't to abolish the rules entirely.

1337JiveTurkey
Feb 17, 2005

Limit the most commonly used passwords and use their credentials to try and log into gmail to see if they're reusing passwords. If nothing else your sworn testimony in front of a Senate subcommittee will serve as a warning to people not to do that.

Bongo Bill
Jan 17, 2012

Do without passwords if you can. Find some other form of authentication. Please, I beg of you.

Ola
Jul 19, 2004

Recently used a service that enforced minimum 1 numeric, minimum 1 punctuation, minimum 8 characters total but maximum 10.

TheresaJayne
Jul 1, 2011
the current bind is that the adjacent characters are limited to just 1 rather than a more acceptable 2 or 3

12 is currently not allowed
123 should be the blocked one possibly or even allow that and block
1234

and again with the duplicate numbers - in a 6 digit pin allow 2 repeating would be more suitable so 112340 would be allowed or allow stuff like 110901 - 9-11 in UK order dd/mm/yy

Dates and shaped are the usual pins for unlocking a phone, a phone with no access to corporate network and only access to the global addressbook and my emails, why so much protection for such a small device, PCs with access to the network are worse....

You must have min 8 characters and have at least one of each of the following, upper case, lower case, number, special character, not contain your username or password
The password is changed every 6 months and you cannot repeat a password (or close to -ie mypasstouse1 mypasstouse2 etc) they have that set to 99 years.
and you have to have a different password on the corporate network, the vpn, the website, any external system
password managers are not allowed either
without the requirement for the number and character it would be nice, there should be a new password rule
min 8 characters and if the password is less than 15 characters the above rules apply otherwise no limits apply.

so you could have S0methingAw£ful or you could do correct horse battery staple

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

a hot gujju bhabhi posted:

Exactly, you're just changing the 25 most commonly used passwords, you're not removing the fact that there will exist 25 passwords that are the most common. What are those 25 passwords? Take the same list SplashData used, filter out only the passwords that match your arbitrary rules and get the top 25 from that.

You end up decreasing the overall set of possible passwords for no actual gain in security as far as I can tell.

the overall set of possible passwords is dominated by good passwords

this is like saying that caches are useless because you still have to do computation and if you take the 25 most common requests and cache them, there will still be a 25 most common uncached set of requests. long computation here = poo poo password

Ola
Jul 19, 2004

TheresaJayne posted:



so you could have S0methingAw£ful or you could do correct horse battery staple

I'd stick with variations of C4Ntwa1tfor4newj0b!, tH1s"j0b"sucks etc. If login security is so important, why no 2FA? It seems like someone near the top has decided "security is super important" but they don't know of any security beyond passwords.

Mooey Cow
Jan 27, 2018

by Jeffrey of YOSPOS
Pillbug

TheresaJayne posted:

The password is changed every 6 months and you cannot repeat a password (or close to -ie mypasstouse1 mypasstouse2 etc) they have that set to 99 years.

Systems that do this are extra cool because it means they are storing the passwords in a way that makes it possible, probably trivial, to retrieve the actual plaintext of the passwords :thumbsup:


Edit: Or at best some description of your password that can surely be used to reduce the time it would take to crack it. But let's face it, they're definitely stored as text.

Mooey Cow fucked around with this message at 12:24 on Jun 20, 2018

teamdest
Jul 1, 2007

Mooey Cow posted:

Systems that do this are extra cool because it means they are storing the passwords in a way that makes it possible, probably trivial, to retrieve the actual plaintext of the passwords :thumbsup:


Edit: Or at best some description of your password that can surely be used to reduce the time it would take to crack it. But let's face it, they're definitely stored as text.

No they aren’t. When you change your password, the old one is kept to do these checks, but the current one is never stored insecurely. The tests to make sure it’s not “too similar” can be done client side by knowing the old passwords and the one you’re trying to change it to without transmitting anything insecurely.

This is a common feature in a lot of authentication systems like Active Directory.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Mooey Cow posted:

Systems that do this are extra cool because it means they are storing the passwords in a way that makes it possible, probably trivial, to retrieve the actual plaintext of the passwords :thumbsup:


Edit: Or at best some description of your password that can surely be used to reduce the time it would take to crack it. But let's face it, they're definitely stored as text.

generally passwords aren't stored, password hashes are, So when you enter the password, it gets hashed using such an algorithm, and the hash is compared, not the actual plaintext. There isn't a simple way of turning a hash into a password because the hash itself doesn't contain enough information by itself for you to get the password, and utilities that try to crack passwords will generally just try every single combination of letters/numbers until you find a password that matches.

If you have rainbow tables (e.g. a dictionary of common passwords -> password hashes for a given algorithm), you can just use the tables to look up the password from the hash - the counter-measure to this is having a 'salt' value in the hash (e.g. instead of just hashing the password, hash the password plus a 'salt' value stored in the database.) In the 90's md5 and sh1 + salt was OK for security, but computers have gotten really fast - it's possible to brute force (try every password and see what its hash is) over 3 million passwords a second against md5, for instance.

But just knowing the hash of the last few passwords stored is no more insecure that the login process itself, given the use of an algorithm like bcrypt to generate hashes.

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀

Bruegels Fuckbooks posted:

generally passwords aren't stored, password hashes are, So when you enter the password, it gets hashed using such an algorithm, and the hash is compared, not the actual plaintext. There isn't a simple way of turning a hash into a password because the hash itself doesn't contain enough information by itself for you to get the password, and utilities that try to crack passwords will generally just try every single combination of letters/numbers until you find a password that matches.

If you have rainbow tables (e.g. a dictionary of common passwords -> password hashes for a given algorithm), you can just use the tables to look up the password from the hash - the counter-measure to this is having a 'salt' value in the hash (e.g. instead of just hashing the password, hash the password plus a 'salt' value stored in the database.) In the 90's md5 and sh1 + salt was OK for security, but computers have gotten really fast - it's possible to brute force (try every password and see what its hash is) over 3 million passwords a second against md5, for instance.

But just knowing the hash of the last few passwords stored is no more insecure that the login process itself, given the use of an algorithm like bcrypt to generate hashes.

How do you tell that two passwords are similar based on their hashes?

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

Dr. Stab posted:

How do you tell that two passwords are similar based on their hashes?

You don't. You make the user enter their old password when they're changing it to a new one so the comparison can be done client-side.

1337JiveTurkey
Feb 17, 2005

If you're checking that a password is the same as previous passwords, you just hash it using the same parameters as the previous passwords and see if it matches, then store however many previous hashes are needed for whatever security policy. With proper bcrypt parameters the old passwords should be mostly useless to an attacker anyhow.

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀

The example given was that if you had "mypasstouse1" previously you couldn't choose "mypasstouse2"

E: storing old passwords in the clear is only a small step above storing present passwords in the clear. You're assuming your dissimilarity metric will cause users to create unique, secure passwords everytime. That's not a very reasonable assumption.

Dr. Stab fucked around with this message at 15:12 on Jun 20, 2018

CPColin
Sep 9, 2003

Big ol' smile.
The example was that you couldn't repeat a password or use a similar one for 99 years. The only way you can check similarity that far back is by allowing your system to reconstitute the plain-text passwords.

What teamdest and Jethro are talking about only works for verifying that your new password doesn't match your current password.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!
While I guess the whole point of this thread is that no one deserves the benefit of the doubt, I would hope that the system is actually "You can't reuse passwords ever (because we store the hashes for all your old passwords) and you can't use a password that is too similar to your current one (because we compare them before we compute and save the hash)."

CPColin
Sep 9, 2003

Big ol' smile.
I liked the system we had for a bit a couple jobs ago where you had to use a password with lower-case, upper-case, numbers, and symbols, but if you were over 12 characters or so, you needed only three of those, over 16 and you needed only two of those. That way, it primarily encouraged longer passwords. They ditched that system when they switched to Active Directory.

Meanwhile, at my current job, also on AD, I discovered one day that I couldn't connect to any of the network shares, because my password had expired. I use Linux, so there was nothing to notify me of that fact or let me change it. I had to fire up my Windows VM in order to add the requisite "1" to my password.

Mooey Cow
Jan 27, 2018

by Jeffrey of YOSPOS
Pillbug

Jethro posted:

While I guess the whole point of this thread is that no one deserves the benefit of the doubt, I would hope that the system is actually "You can't reuse passwords ever (because we store the hashes for all your old passwords) and you can't use a password that is too similar to your current one (because we compare them before we compute and save the hash)."

One would hope so, but consider how many times we've heard that millions passwords are now compromised because some site got hacked and turns out they didn't even hash the passwords... I've had to use systems in the past that required your new passwords to be dissimilar from your current as well as any previous passwords, so they were definitely storing something more than just hashes.

It'd be nice if all sites and whatever could be open with how they handle secret information. But hey, at least we have a law that requires them to say if they use cookies :v:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I once saw a site the encrypted the passwords with base64

1337JiveTurkey
Feb 17, 2005

For checking whether any close numerical relatives exist for a given password, perform the transformations before hashing it. So if there’s a number on the end try decrementing it by one and test that instead of storing and transforming the old password. It’s not robust but it’ll catch the worst password patterns.

Mooey Cow
Jan 27, 2018

by Jeffrey of YOSPOS
Pillbug
Facebook apparently uses a method where they store hashes of various common permutations of your passwords and then compares against all of them for a similarity check, and people are recommending others to also do this if they want that kind of functionality. But seems to me that 1) that'll take up a lot of space and 2) that you'll give an attacker a big box of near hits and an algorithm that can probably generate the full set of possibilities that will contain the real password from a single near hit. Maybe not though, or maybe they think it's worth it :shrug:

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Mooey Cow posted:

Facebook apparently uses a method where they store hashes of various common permutations of your passwords and then compares against all of them for a similarity check, and people are recommending others to also do this if they want that kind of functionality. But seems to me that 1) that'll take up a lot of space and 2) that you'll give an attacker a big box of near hits and an algorithm that can probably generate the full set of possibilities that will contain the real password from a single near hit. Maybe not though, or maybe they think it's worth it :shrug:

Let's say that a password hash is 128bit / 16 bytes and that there are 10k "common permutations" for each password. That's an extra 156kB of storage per user. Nontrivial, maybe, but not remotely close to the storage dedicated for all the poo poo the user's doing with your system.

You also don't tell the user that their password is too close to an old password unless they've also provided their current password as part of the transaction. So the attacker would need to already have access to their current password in order to gain any information.

Adbot
ADBOT LOVES YOU

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE
Have I been pwned has an API. Isn’t that sufficient?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply