We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
the code
#include "ENCRYPTO_utils/constants.h" #include "ENCRYPTO_utils/typedefs.h" #include <ENCRYPTO_utils/crypto/crypto.h> #include <cstdint> #include <iostream> void print_bytes(uint8_t *bytes, uint32_t num_bytes) { for (uint32_t i = 0; i < num_bytes; i++) { std::cout << (int)bytes[i] << " "; } std::cout << std::endl; } #define RANDOM_BYTES_NUM 16 int main() { uint8_t random_bytes[RANDOM_BYTES_NUM]; uint8_t seed = 42; seclvl secure_level = ST; uint32_t random_bytes_num = RANDOM_BYTES_NUM; crypto crypto_obj(secure_level.symbits, &seed); crypto_obj.gen_rnd(random_bytes, random_bytes_num); print_bytes(random_bytes, random_bytes_num); std::cout << "seed: " << (int)seed << std::endl; std ::cout << "random_bytes_num: " << random_bytes_num << std::endl; crypto_obj.gen_rnd_from_seed(random_bytes, random_bytes_num, &seed); print_bytes(random_bytes, random_bytes_num); }
Output
152 227 184 124 228 237 196 24 218 98 124 189 49 97 171 171 seed: 42 random_bytes_num: 16 152 227 184 124 228 237 196 24 218 98 124 189 49 97 171 171
Now I just exchange the sequence of these two lines like :
uint32_t random_bytes_num = RANDOM_BYTES_NUM; crypto crypto_obj(secure_level.symbits, &seed);
to
so the code is
#include "ENCRYPTO_utils/constants.h" #include "ENCRYPTO_utils/typedefs.h" #include <ENCRYPTO_utils/crypto/crypto.h> #include <cstdint> #include <iostream> void print_bytes(uint8_t *bytes, uint32_t num_bytes) { for (uint32_t i = 0; i < num_bytes; i++) { std::cout << (int)bytes[i] << " "; } std::cout << std::endl; } #define RANDOM_BYTES_NUM 16 int main() { uint8_t random_bytes[RANDOM_BYTES_NUM]; uint8_t seed = 42; seclvl secure_level = ST; crypto crypto_obj(secure_level.symbits, &seed); uint32_t random_bytes_num = RANDOM_BYTES_NUM; crypto_obj.gen_rnd(random_bytes, random_bytes_num); print_bytes(random_bytes, random_bytes_num); std::cout << "seed: " << (int)seed << std::endl; std ::cout << "random_bytes_num: " << random_bytes_num << std::endl; crypto_obj.gen_rnd_from_seed(random_bytes, random_bytes_num, &seed); print_bytes(random_bytes, random_bytes_num); }
now the strange things have happened, the output turns to
236 115 137 45 80 65 119 233 123 140 77 2 95 172 158 251 seed: 42 random_bytes_num: 16 152 227 184 124 228 237 196 24 218 98 124 189 49 97 171 171
It does confuse me and I need help 🙂
The text was updated successfully, but these errors were encountered:
No branches or pull requests
the code
Output
Now I just exchange the sequence of these two lines like :
to
so the code is
now the strange things have happened, the output turns to
It does confuse me and I need help 🙂
The text was updated successfully, but these errors were encountered: