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

Wrap randombytes #22

Merged
merged 2 commits into from
Mar 20, 2017
Merged

Wrap randombytes #22

merged 2 commits into from
Mar 20, 2017

Conversation

silkeh
Copy link
Contributor

@silkeh silkeh commented Mar 18, 2017

This wraps randombytes as it is in libsodium 1.0.12.

There are two things to note:

  • The RandomBytes() function does not place bytes in a buffer like in libsodium, but returns a specified number of random bytes instead. Example:
    randBytes := randombytes.RandomBytes(16)
    Perhaps it should be named RandomBytesBytes().
  • RandomBytesSalsa20Implementation and RandomBytesSysRandomImplementation are pointers, making the use of RandomBytesSetImplementation() as follows:
    randombytes.RandomBytesSetImplementation(randombytes.RandomBytesSalsa20Implementation)

@redragonx
Copy link
Contributor

It would be useful if there was a comment that mentions the different expected outputs (with the changes)

@silkeh
Copy link
Contributor Author

silkeh commented Mar 20, 2017

For completeness I have added comments to all functions explaining their use.

@redragonx redragonx merged commit db67a0d into GoKillers:master Mar 20, 2017
@redragonx
Copy link
Contributor

Thanks for doing that!

@silkeh silkeh deleted the randombytes branch March 24, 2017 16:30
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