From 240e6e995745185c34249f1939d4c0d469a6746e Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Thu, 25 Sep 2025 21:53:40 -0700 Subject: Move complex crypto logic into a helper package --- tools/finditers/finditers.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tools/finditers/finditers.go') 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) } } -- cgit v1.3.1