Skip to content

Store seed in relinkey new#2

Open
drorr-cr wants to merge 17 commits intomainfrom
store-seed-in-relinkey-new
Open

Store seed in relinkey new#2
drorr-cr wants to merge 17 commits intomainfrom
store-seed-in-relinkey-new

Conversation

@drorr-cr
Copy link
Copy Markdown

No description provided.

@drorr-cr drorr-cr requested a review from NoamK-CR December 25, 2025 16:29
const NativeVector::Integer& modulus){
this->SetModulus(modulus);

if (size != 65536)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is OK for us, but not to push on any main branch...

const NativeVector::Integer& modulus){
this->SetModulus(modulus);

if (size != 65536)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use constexpr

Suggested change
if (size != 65536)
if (size != CR_VECTOR_SIZE)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

NativeVector v(size, this->m_modulus);
std::uniform_int_distribution<uint32_t> dist(DUG_CHUNK_MIN, DUG_CHUNK_MAX);

for (uint16_t seg_i = 0; seg_i < 2048; ++seg_i) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

std::unique_ptr<PRNG> shake128engine = std::make_unique<Shake128Engine>(m_seed, m_salt, modulus.ConvertToInt(), seg_i);

size_t valid_words_idx = 0;
uint32_t n_q = (static_cast<uint32_t>((1ULL << 32) / modulus.ConvertToInt())) * modulus.ConvertToInt();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does everything need to be converted to native int?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

initKey[1] = static_cast<uint32_t>(std::hash<std::thread::id>{}(std::this_thread::get_id()));

// Heap address entropy
void* mem = malloc(1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you copy this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to a simpler random method


size_t valid_words_idx = 0;
uint32_t n_q = (static_cast<uint32_t>((1ULL << 32) / modulus.ConvertToInt())) * modulus.ConvertToInt();
int64_t n_q_h = static_cast<int64_t>(n_q) /2;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be 32 bits

std::uniform_int_distribution<uint32_t> dist;

bool rdGenPassed = false;
size_t attempts = 3;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try const int

result->SetLength(batchSize);
std::cout << "x^18 + x^9 + 1 = " << result << std::endl;

/*
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is a copy from somewhere else, specify where it came from and remove the commented code

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

Successfully merging this pull request may close these issues.

2 participants