HashPals / Name-That-Hash

🔗 Don't know what type of hash it is? Name That Hash will name that hash type! 🤖 Identify MD5, SHA256 and 300+ other hashes ☄ Comes with a neat web app 🔥
https://nth.skerritt.blog
GNU General Public License v3.0
1.46k stars 103 forks source link

[Easy] Added MS Office <= 2003, Blake2b-512, Telegram Mobile App Passcode #91

Closed bee-san closed 3 years ago

bee-san commented 3 years ago

https://github.com/HashPals/Name-That-Hash/pull/69#issue-596748318

^^ That PR already contains the stuff. Make a new PR (or fix the merge conflicts + tests) to contribute && finish this issue :)

amadejpapez commented 3 years ago

Hi @bee-san! I just saw that the tests from my PR #92 that was aimed to solve this issue are actually failing and I cannot figure out why. The error is in the test_main.py in the latest Office hash test.

Hash name in tests is the same as name in the database and the regex matches the hash so the test should be successful. This is the error message:

tests/test_main.py:226: AssertionError
=========================== short test summary info ============================
FAILED tests/test_main.py::test_office - assert 'MS Office ⇐ 2003 $0/$1, MD5 ...
========================= 1 failed, 35 passed in 0.28s =========================
Command poetry run pytest failed with exit code 1
Session tests failed.
Error: Process completed with exit code 1.
bee-san commented 3 years ago

It's probably string matching, it's quite hard to match entire strings like that. Specifically might be breaking it? I would assert using regex here :)

amadejpapez commented 3 years ago

I also thought that maybe some character in the name is causing this error. So asserting regex like this assert "\$oldoffice\$[a-f0-9*]{100}:[a-f0-9]{10}" in x instead of the name should make the test work?

bee-san commented 3 years ago

That's so advanced! I would do:

assert re.find("MS Office", x)

I think that'd work?

amadejpapez commented 3 years ago

True that would cause even more errors hahah. Will open a new PR now with what you suggested. :D

bee-san commented 3 years ago

Make sure to run pytest to test it! :-)