diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-09-25 21:53:40 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-09-25 21:53:40 -0700 |
| commit | 240e6e995745185c34249f1939d4c0d469a6746e (patch) | |
| tree | b739a4ab16f3b6ab9981c6c433dbe92ff6bdeddc /tools/finditers/finditers.go | |
| parent | Use AES-CTR-HMAC-SHA256 instead of AES-GCM (diff) | |
| download | roseh.moe-240e6e995745185c34249f1939d4c0d469a6746e.tar.zst | |
Move complex crypto logic into a helper package
Diffstat (limited to 'tools/finditers/finditers.go')
| -rw-r--r-- | tools/finditers/finditers.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/finditers/finditers.go b/tools/finditers/finditers.go index 2a256c8..cd144fa 100644 --- a/tools/finditers/finditers.go +++ b/tools/finditers/finditers.go @@ -8,19 +8,27 @@ import ( "testing" "time" - "gitlab.com/rhogenson/roseh.moe/internal/pwhash" + "gitlab.com/rhogenson/roseh.moe/internal/cryptoutil" ) +func mustHex(s string) []byte { + bytes, err := hex.DecodeString(s) + if err != nil { + panic(fmt.Sprintf("mustHex: bad hex %q: %s", s, err)) + } + return bytes +} + var ( iterations int - salt, _ = hex.DecodeString("3fb84513fc3afcd6d3b230bf9ece91aaae2d2a99da17efbf7de83b21fafe3f08") + salt = mustHex("3fb84513fc3afcd6d3b230bf9ece91aaae2d2a99da17efbf7de83b21fafe3f08") ) func BenchmarkHashIter(b *testing.B) { const password = "oboe shortness ether ideology undesired fresh freezable catching mashing glimpse" for b.Loop() { - pwhash.HashIter(password, salt, iterations) + cryptoutil.HashIter(password, salt, iterations) } } |
