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

Move crypto.randomBytes() to crypto.random.bytes() #6821

Closed
wants to merge 1 commit into from

Conversation

jedisct1
Copy link
Contributor

Makes things a little bit more organized and was suggested by Andrew.

@jedisct1 jedisct1 force-pushed the random.bytes branch 2 times, most recently from 2e6f34a to 5020e6a Compare October 26, 2020 16:08
@daurnimator daurnimator added the standard library This issue involves writing Zig code for the standard library. label Oct 27, 2020
@daurnimator
Copy link
Contributor

IMO we should remove this public function from the std.crypto namespace and keep it in std.rand

@jedisct1
Copy link
Contributor Author

Having it std.crypto makes it clear that this is a CSPRNG. If you need to generate a secret for functions in the same namespace, you will immediately find it.

Comment on lines +123 to +125
pub const random = struct {
pub const bytes = std.os.getrandom;
};
Copy link
Member

@andrewrk andrewrk Oct 29, 2020

Choose a reason for hiding this comment

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

I think I didn't explain the idea well enough. It is to make std.crypto.random be an instance of the Random interface backed by a thread-local CSPRNG - #6704

@jedisct1 jedisct1 closed this Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants