Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can we be certain that the hashing is correct? #239

Open
IvanVnucec opened this issue Aug 25, 2021 · 9 comments
Open

How can we be certain that the hashing is correct? #239

IvanVnucec opened this issue Aug 25, 2021 · 9 comments

Comments

@IvanVnucec
Copy link

The problem is that we are mining cryptos rather slowly compared to the ASICs machines. Because of that, how can we be assured that the hashing algorithms works correctly other than watching our wallet getting money (which could take a while).

@pooler
Copy link
Owner

pooler commented Aug 25, 2021

All the algorithm implementations in cpuminer have been tested.

If one has the time, it would also be quite easy to write a simple getwork server that serves mock low-difficulty jobs and checks that submitted solutions meet the target.

@IvanVnucec
Copy link
Author

How did you test the algorithm implementations?

@pooler
Copy link
Owner

pooler commented Aug 25, 2021

The implementations were tested both manually (using known block headers) and by mining. Keep in mind that this was quite a few years ago, when CPU mining was still practically possible.

@IvanVnucec
Copy link
Author

IvanVnucec commented Aug 25, 2021

Could you provide me with some known block headers and their correct hashes? I'm willing to make test cases because I did a few code changes, and now I'm in dilemma if the code (still) works or not.

Also, do you have some documentation regarding algorithm implementation, specifically sha256? I'm finding it hard to track current code with the strange function names and lack of comments.

@pooler
Copy link
Owner

pooler commented Aug 25, 2021

Could you provide me with some known block headers and their correct hashes?

You should use a block explorer or a coin daemon to fetch this kind of data.

Also, do you have some documentation regarding algorithm implementation, specifically sha256? I'm finding it hard to track current code with the strange function names and lack of comments.

Sorry, I never wrote any documentation about the implementation details.

@IvanVnucec
Copy link
Author

IvanVnucec commented Aug 25, 2021

Sorry, I never wrote any documentation about the implementation details.

Do you have documentation from which you've written those hashing functions?

@pooler
Copy link
Owner

pooler commented Aug 25, 2021

For SHA-256 there is plenty of documentation available online. When I first started I think I simply used ArtForz's code (see sha256_transform()) as a base, and went from there.

@IvanVnucec
Copy link
Author

Ok thanks.

@IvanVnucec
Copy link
Author

IvanVnucec commented Aug 26, 2021

I'm going to reopen it because someone might want to write a solution to the problem of validating the hashing algorithm.

@IvanVnucec IvanVnucec reopened this Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants