diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-10-07 08:31:39 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-10-07 08:41:15 -0700 |
| commit | bcc1c2d9dd7fefa538647c0d4e9e621511f1fde6 (patch) | |
| tree | 64bd8f2b15dd3a737ae8d2db683641474acaff3f /internal/hole/hole.go | |
| parent | Add uploader tool (diff) | |
| download | roseh.moe-bcc1c2d9dd7fefa538647c0d4e9e621511f1fde6.tar.zst | |
Bring back pbkdf2
Diffstat (limited to 'internal/hole/hole.go')
| -rw-r--r-- | internal/hole/hole.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/hole/hole.go b/internal/hole/hole.go new file mode 100644 index 0000000..4824459 --- /dev/null +++ b/internal/hole/hole.go @@ -0,0 +1,25 @@ +package hole + +import ( + "crypto/rand" + _ "embed" + "encoding/binary" + "strings" +) + +var ( + //go:embed wordlist.txt + wordListString string + wordList = strings.Split(strings.TrimSuffix(wordListString, "\n"), "\n") +) + +func New() string { + const nWords = 10 + buf := make([]byte, 2*nWords) + rand.Read(buf) + words := make([]string, nWords) + for i := range words { + words[i] = wordList[binary.NativeEndian.Uint16(buf[2*i:])&0x1fff] + } + return strings.Join(words, "-") +} |
