summaryrefslogtreecommitdiffstats
path: root/diceware.go
diff options
context:
space:
mode:
Diffstat (limited to 'diceware.go')
-rw-r--r--diceware.go20
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, " "))
+}