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

Add an example of using Crypto3 with clang (non-zkllvm) compiler #2

Open
NickVolynkin opened this issue Jun 26, 2023 · 1 comment
Open
Labels
documentation Improvements or additions to documentation

Comments

@NickVolynkin
Copy link

Developers need an example of how to use Crypto3 in the standard development workflow. That is, compile code into an executable and run unit tests. This example would be enough:

auto a = hashes::sha2<256>::block_type {1}
auto b = hashes::sha2<256>::block_type {2}
bool matched = hash<hashes::sha2<256>>(a, b) == ff55c97976a840b4ced964ed49e3794594ba3f675238b5fd25d282b60f70a194;
std::cout << matched;

See also NilFoundation/zkllvm-template#27

@nemothenoone nemothenoone transferred this issue from NilFoundation/zkllvm-template Jun 26, 2023
@nkaskov
Copy link

nkaskov commented Jun 26, 2023

Hashes return byteblob. Thus you cannot compare it with ff55c97976a840b4ced964ed49e3794594ba3f675238b5fd25d282b60f70a194
Besides, C++ does not support such long constants.

Possible solution: make byte array from this number and compare with the output of hash function.

@NickVolynkin NickVolynkin added the documentation Improvements or additions to documentation label Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants