imsky / PocketEuler

:heavy_plus_sign: Offline version of Project Euler.
116 stars 11 forks source link

Problem 8 in project-euler-sha1-hashed-solutions.json #77

Closed bstempi closed 7 years ago

bstempi commented 7 years ago

I'm currently using this project (specifically, project-euler-sha1-hashed-solutions.json) to check my answers (code posted here: https://github.com/bstempi/euler-python). I have the correct answer to problem 8, but I get a different SHA1 hash.

My answer's hash: ace964f95ecbc00fe1c8e37036bf242fffbbfd1f Hash from solutions: e98c13fc9df6a893efa0c57bcfa548be664ab8c8

My solutions for 1-7 hash correctly, so I don't think I'm doing anything wrong when hashing.

Any ideas?

yehoshuapw commented 7 years ago

As you can see, this came from https://gist.github.com/dnerdy/30e2847188a95178688f, which comes from project-euler-offline. (As can be see in the code, it uses triple-DES).

So this really should be asked there, but it does seem like a error. (the hash of the solution gives ace964f95ecbc00fe1c8e37036bf242fffbbfd1f, and small changes like newlines and spaces still won't give e98c13fc9df6a893efa0c57bcfa548be664ab8c8. Finding the reverse hash of that, might give some insights.)

Also, about posting your code: ProjectEuler:about

I learned so much solving problem XXX so is it okay to publish my solution elsewhere?

It appears that you have answered your own question. There is nothing quite like that "Aha!" moment when you finally beat a problem which you have been working on for some time. It is often through the best of intentions in wishing to share our insights so that others can enjoy that moment too. Sadly, however, that will not be the case for your readers. Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery. Please do not deny others what you have so richly valued yourself.

If you really must, do it in a private repository, or encrypt the code using the solution.

yehoshuapw commented 7 years ago

I decrypted the file at project-euler-offline, and found out the solution to 8 there is 40824. This gives:

echo -n 40824 | sha1sum = e98c13fc9df6a893efa0c57bcfa548be664ab8c8

I checked the matter, and only 8 is different.

bstempi commented 7 years ago

That answer doesn't match what's on the Project Euler site.

Should I open a PR to correct some of those SHA1 hashes?

imsky commented 7 years ago

seems resolved via #78 @bstempi