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

Allow RandomNonceBox to decrypt the same cipher text multiple times #97

Merged
merged 2 commits into from
Feb 22, 2014
Merged

Conversation

Asmod4n
Copy link
Contributor

@Asmod4n Asmod4n commented Feb 21, 2014

https://github.com/cryptosphere/rbnacl/blob/master/lib/rbnacl/random_nonce_box.rb#L105 was preventing RandomNonceBox to open the same enciphered message multiple times

@@ -102,8 +102,8 @@ def generate_nonce
end

def extract_nonce(bytes)
nonce = bytes.slice!(0, nonce_bytes)
Copy link
Contributor

Choose a reason for hiding this comment

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

Scumbag mutation :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was exceptionally bad when used with a database library which changes stuff as soon as you change a variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Asmod4n sorry you had to track this down. We shouldn't mutate inputs unless we have a type that's designed for that purpose (e.g. RbNaCl::Buffer)

@tarcieri
Copy link
Contributor

Seems good

tarcieri added a commit that referenced this pull request Feb 22, 2014
Allow RandomNonceBox to decrypt the same cipher text multiple times
@tarcieri tarcieri merged commit a85fc6e into RubyCrypto:master Feb 22, 2014
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.

None yet

2 participants