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

0.9 OsRng does not seem to implement CryptoRng ? #1561

Closed
pinkforest opened this issue Jan 28, 2025 · 1 comment · Fixed by #1562
Closed

0.9 OsRng does not seem to implement CryptoRng ? #1561

pinkforest opened this issue Jan 28, 2025 · 1 comment · Fixed by #1562

Comments

@pinkforest
Copy link

pinkforest commented Jan 28, 2025

Common issues

Problem: CryptoRng is not implemented for OsRng

Quick solution: `?

Details: It seems it only implements the fallible version now? Is this intentional?

I assume that this is may be intentional given OsRng may fail? Tried to find the discussion.

Notes

@dhardy
Copy link
Member

dhardy commented Jan 28, 2025

CryptoRng now requires RngCore (thus replacing CryptoRngCore) which OsRng no longer implements. OsRng does implement TryCryptoRng.

Yes, getrandom can technically fail, though this isn't usually observed.

If you wish a panic-on-error version of OsRng, you may use OsRng.unwrap_err(). The result (UnwrapErr<OsRng>) should implement CryptoRng.

Noted, we should update the CHANGELOG for rand_core.

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 a pull request may close this issue.

2 participants