3 ms·
A friend was recently trying to use webassembly from rust and ran into an issue where he couldnt use anything that depended on rust's random - because it depend
by netcraft 9y ago
A friend was recently trying to use webassembly from rust and ran into an issue where he couldnt use anything that depended on rust's random - because it depended on a nano scale clock from the system. With problems like meldown/spectre, how could this even be resolved in the future? Would anything that depended on that need to use a random function from js instead?
- wyldfire 9y agoMaybe eventually if retpoline robustly resolves the issue of speculative execution, the high precision clock access could be restored?
- imtringued 9y agoAlternatively the problem could be fixed directly in the hardware.
- steveklabnik 9y agoSo, at first, it will compile, but fail: https://github.com/rust-lang-nursery/rand/pull/197 https://github.com/rust-lang-nursery/rand/pull/197 Then, two weeks ago https://github.com/rust-lang-nursery/rand/pull/272 https://github.com/rust-lang-nursery/rand/pull/272 > Would anything that depended on that need to use a random function from js instead? Your instinct is right, that's what the above does. (more specifically, with https://developer.mozilla.org/en-US/docs/Web/API/RandomSource/getRandomValues https://developer.mozilla.org/en-US/docs/Web/API/RandomSourc... )