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

POW for creating AES ciphers #10

Merged
merged 4 commits into from
Mar 9, 2023
Merged

POW for creating AES ciphers #10

merged 4 commits into from
Mar 9, 2023

Conversation

poszu
Copy link
Collaborator

@poszu poszu commented Mar 7, 2023

No description provided.

@poszu poszu requested a review from fasmat March 7, 2023 10:43
@fasmat fasmat requested review from dshulyak and removed request for fasmat March 7, 2023 13:55
@poszu poszu requested a review from fasmat March 8, 2023 14:46
impl AesCipher {
pub(crate) fn new(challenge: &[u8; 32], nonce: u32, params: ScryptParams) -> Self {
let mut key = [0u8; 16];
scrypt(challenge, &nonce.to_le_bytes(), params, &mut key);
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a specific reason why scrypt was chosen here instead of blake3?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that scrypt was chosen because of its ASIC-resistance. @fasmat could you help answering?

Copy link
Member

Choose a reason for hiding this comment

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

The reason why we hash the challenge and the nonce is because we want checking part of the post data with many nonces to be more costly than checking the full data with few nonces.

Scrypt serves better as a proof of work in this regard and was suggested by the research team.

As to why we are using scrypt + keccak instead of scrypt + blake3: because we are already using the former for label creation and won't change that before genesis.

If at any point we switch to scrypt+blake for label generation we can do that here as well.

@poszu poszu added this pull request to the merge queue Mar 9, 2023
Merged via the queue into main with commit a7c2a15 Mar 9, 2023
@poszu poszu deleted the aes-pow branch March 9, 2023 14:06
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.

3 participants