From 5859604f830471a1177fb0e50a976b4d74415b8a Mon Sep 17 00:00:00 2001 From: metacryst Date: Wed, 29 Oct 2025 22:40:10 -0500 Subject: [PATCH] password hashing util function --- server/main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/main.go b/server/main.go index 3cacd6f..c02bb66 100644 --- a/server/main.go +++ b/server/main.go @@ -14,6 +14,8 @@ import ( "github.com/gorilla/websocket" "github.com/golang-jwt/jwt/v5" "github.com/rs/zerolog/log" + + "github.com/alexedwards/argon2id" ) func isWebSocketRequest(r *http.Request) bool { @@ -22,6 +24,16 @@ func isWebSocketRequest(r *http.Request) bool { return strings.Contains(connHeader, "upgrade") && upgradeHeader == "websocket" } +func HashPassword() { + hash, err := argon2id.CreateHash("banktest", argon2id.DefaultParams) + if err != nil { + log.Fatal().Msgf("failed to hash password: %v", err) + } + + fmt.Println("Argon2id hash: ") + fmt.Println(hash) +} + func main() { config.SetConfiguration() logger.ConfigureLogger()