https://github.com/jedisct1/tinygo-wasi_rand
crypto/rand for TinyGo/WASI
https://github.com/jedisct1/tinygo-wasi_rand
crypto csprng tinygo wasi wasm
Last synced: 7 months ago
JSON representation
crypto/rand for TinyGo/WASI
- Host: GitHub
- URL: https://github.com/jedisct1/tinygo-wasi_rand
- Owner: jedisct1
- License: mit
- Created: 2021-05-24T13:45:07.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-24T18:39:50.000Z (over 4 years ago)
- Last Synced: 2025-01-11T23:33:13.553Z (9 months ago)
- Topics: crypto, csprng, tinygo, wasi, wasm
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A CSPRNG for TinyGo/WebAssembly (WASI)
TinyGo doesn't support `crypto/rand` yet, which is quite of a deal breaker for many cryptographic operations.
This module implements `wasi_rand`, a secure random number generator for TinyGo when used in a WebAssembly/WASI environment.
Usage:
```go
import (
wasi_rand "github.com/jedisct1/tinygo-wasi_rand"
)func main() {
var key [32]byte
if err := wasi_rand.Read(key[:]); err != nil {
// panic: no entropy source available
}
}
````wasi_rand.Read()` can fill buffers of arbitrary sizes.