You keep claiming the "hash" function returns only the first 5 characters of the hash, which it does not, and should not or the thing wouldn't work.
It seems quite pointless to go through a transformation of a clear list into an inefficient format. It's something I see pretty regularly and it confuses me why not do the matching when looping through the result the first time, so e.g.
Split into lines with \r\n like you already do
Filter into lines whose start matches the hash tail
Backend-focused software engineer, interested in building products, open source, blogging and helping others out. I am currently dabbling with Go, Elixir and reading about evolutionary architectures.
That's actually a very solid point. It's probably a trap of some sort where the author wants to make the article a bit more interesting for the reader which backfires. Both of your points are correct - the wording should be fixed and the general algorithm should be simplified, which I will do ASAP. Thanks for reading & the feedback!
Actually there's a small problem with the solution I suggested as well - technically two different passwords may end up with the same SHA1 hash result, so in the last step you should return a sum of them :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
A couple of quick comments:
You keep claiming the "hash" function returns only the first 5 characters of the hash, which it does not, and should not or the thing wouldn't work.
It seems quite pointless to go through a transformation of a clear list into an inefficient format. It's something I see pretty regularly and it confuses me why not do the matching when looping through the result the first time, so e.g.
\r\n
like you already do:
:
ornil
?
That's actually a very solid point. It's probably a trap of some sort where the author wants to make the article a bit more interesting for the reader which backfires. Both of your points are correct - the wording should be fixed and the general algorithm should be simplified, which I will do ASAP. Thanks for reading & the feedback!
Actually there's a small problem with the solution I suggested as well - technically two different passwords may end up with the same SHA1 hash result, so in the last step you should return a sum of them :)