diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-10-11 21:19:01 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-10-11 21:19:01 -0700 |
| commit | 18175866466e4788d172baa68805977f34b9df37 (patch) | |
| tree | 2260e42e420053c4f6c3debb9d0ba96939802086 /diceware.go | |
| download | diceware-18175866466e4788d172baa68805977f34b9df37.tar.zst | |
Initial commit
Diffstat (limited to 'diceware.go')
| -rw-r--r-- | diceware.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/diceware.go b/diceware.go new file mode 100644 index 0000000..3716171 --- /dev/null +++ b/diceware.go @@ -0,0 +1,20 @@ +package main + +import ( + "crypto/rand" + "encoding/binary" + "fmt" + "strings" + + "roseh.moe/pkg/wordlist" +) + +func main() { + buf := make([]byte, 20) + rand.Read(buf) + words := make([]string, 10) + for i := range words { + words[i] = wordlist.Words[binary.NativeEndian.Uint16(buf[2*i:])&0x1fff] + } + fmt.Println(strings.Join(words, " ")) +} |
