Skip to content

[Wasm] Implement secure random generator #2240

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

Merged
merged 1 commit into from
May 24, 2022
Merged

[Wasm] Implement secure random generator #2240

merged 1 commit into from
May 24, 2022

Conversation

hewigovens
Copy link
Contributor

@hewigovens hewigovens commented May 24, 2022

Fixes #2220

Emscripten already uses random API (via getRandomDevice) available on Browser or Node, see https://github.com/emscripten-core/emscripten/blob/main/src/library.js#L2204

What we do here is simple, we wrap std::random_device with std::mt19937 and return a random uint32 value, inspired by emscripten-core/emscripten#12240

@hewigovens hewigovens requested a review from optout21 as a code owner May 24, 2022 04:43
@hewigovens hewigovens merged commit 5b8beb9 into master May 24, 2022
@hewigovens hewigovens deleted the h/wasm-random branch May 24, 2022 09:10
DeanDonkov pushed a commit to changex-app/wallet-core that referenced this pull request Apr 7, 2023
zkrypt-crossbar pushed a commit to Cramiumlabs/wallet-core that referenced this pull request Jun 15, 2025
zkrypt-crossbar pushed a commit to Cramiumlabs/wallet-core that referenced this pull request Jun 21, 2025
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.

[Wasm] Use secure random generator
4 participants