-
Notifications
You must be signed in to change notification settings - Fork 0
Store seed in relinkey #1
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| namespace lbcrypto { | ||
|
|
||
| inline std::vector<uint32_t> GenerateRandomSeed(size_t size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use the existing implementation if it isn't too difficult.
|
|
||
| // 2. Absorb the seed (inject entropy) | ||
| // We cast the vector to bytes for absorption | ||
| if (!seed.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch to assert seed.length() == 32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| for (uint16_t seg_i = 0; seg_i < 2048; ++seg_i){ | ||
| std::unique_ptr<PRNG> shake128engine = std::make_unique<Shake128Engine>(m_seed,m_salt,qIndex,seg_i); | ||
|
|
||
| std::uniform_int_distribution<uint32_t> dist(DUG_CHUNK_MIN, DUG_CHUNK_MAX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| // Convert 32-bit word to 4 bytes (little-endian) | ||
| digest[4*i] = static_cast<uint8_t>(word & 0xFF); | ||
| digest[4*i + 1] = static_cast<uint8_t>((word >> 8) & 0xFF); | ||
| digest[4*i + 2] = static_cast<uint8_t>((word >> 16) & 0xFF); | ||
| digest[4*i + 3] = static_cast<uint8_t>((word >> 24) & 0xFF); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary, you can do rejection here, or directly construct 42 words
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| // ----------------------------------------------------------------------------- | ||
| // Function: extract_32_words_from_digest | ||
| // ----------------------------------------------------------------------------- | ||
| inline std::array<int32_t, 32> extract_32_words_from_digest(const std::array<uint8_t, 168>& digest, uint32_t q) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See if this works:
| inline std::array<int32_t, 32> extract_32_words_from_digest(const std::array<uint8_t, 168>& digest, uint32_t q) { | |
| template <typename VecType> | |
| inline std::array<int32_t, 32> extract_32_words_from_digest(const std::array<uint8_t, 168>& digest, VecType::Integer &q) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| private: | ||
|
|
||
| protected: | ||
| typename VecType::Integer m_modulus{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this protected, others private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| template <typename VecType> | ||
| class DiscreteUniformGeneratorCRImpl : public DiscreteUniformGeneratorImpl<VecType> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| template <typename VecType> | |
| class DiscreteUniformGeneratorCRImpl : public DiscreteUniformGeneratorImpl<VecType> { | |
| class DiscreteUniformGeneratorCRImpl : public DiscreteUniformGeneratorImpl<NativeVector> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
fixed test serialized data size
No description provided.