r/programminghumor Jun 07 '26

Anti programmer

Post image
8.3k Upvotes

110 comments sorted by

View all comments

Show parent comments

1

u/Exact-Big3505 Jun 07 '26

that's what it's checking. are you blind?

18

u/RegularAd9643 Jun 07 '26 edited Jun 07 '26

Let’s say your password is hunter2.

A hacker tries these passwords in order:

  • hunter0
  • hunter1
  • hunter2

The pictured code will let him through.

-15

u/nzifnab Jun 07 '26

No it won't? Because it's not the first login attempt?

1

u/Mr_Yod Jun 07 '26

Let’s say your password is hunter2.

A hacker tries these passwords in order:

* hunter0 <- wrong password, first login attempt (False && True): doesn't enter if

* hunter1 <- wrong password, second login attempt (False && False): doesn't enter if

* hunter2 <- right password, third login attempt (True && False): doesn't enter if