summaryrefslogtreecommitdiffstats
path: root/tools/hashpw
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-09-25 21:53:40 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-09-25 21:53:40 -0700
commit240e6e995745185c34249f1939d4c0d469a6746e (patch)
treeb739a4ab16f3b6ab9981c6c433dbe92ff6bdeddc /tools/hashpw
parent251ea4f8fcfd0960f6a627501eb556e109a3e2b6 (diff)
downloadroseh.moe-240e6e995745185c34249f1939d4c0d469a6746e.tar.zst
Move complex crypto logic into a helper package
Diffstat (limited to 'tools/hashpw')
-rw-r--r--tools/hashpw/hashpw.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/hashpw/hashpw.go b/tools/hashpw/hashpw.go
index 5bc740d..7705b31 100644
--- a/tools/hashpw/hashpw.go
+++ b/tools/hashpw/hashpw.go
@@ -1,11 +1,10 @@
package main
import (
- "crypto/rand"
"fmt"
"os"
- "gitlab.com/rhogenson/roseh.moe/internal/pwhash"
+ "gitlab.com/rhogenson/roseh.moe/internal/cryptoutil"
"golang.org/x/term"
)
@@ -16,13 +15,11 @@ func run() error {
if err != nil {
return err
}
- salt := make([]byte, pwhash.SaltLen)
- rand.Read(salt)
- _, hashedPassword, err := pwhash.Hash(string(password), salt)
+ hashedPassword, err := cryptoutil.Hash(string(password))
if err != nil {
return err
}
- fmt.Printf("notepad-password=%x%x\n", salt, hashedPassword)
+ fmt.Printf("notepad-password=%s\n", hashedPassword)
return nil
}