refactor: extract SHA3 hashing utilities to utils/hash.go

- Move all SHA3-512 hashing functions to utils package
- Update import statements and function calls
- Maintain zero functional changes
- First step in systematic main.go refactoring

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-18 18:36:47 +03:00
parent 7d7e6e412a
commit f9965c8f9c
4 changed files with 134 additions and 25 deletions

25
utils/hash.go Normal file
View File

@@ -0,0 +1,25 @@
package utils
import (
"encoding/hex"
"golang.org/x/crypto/sha3"
)
// SHA3-512 hashing utilities for Phase 2 authentication
func HashSHA3512(input string) string {
hasher := sha3.New512()
hasher.Write([]byte(input))
return hex.EncodeToString(hasher.Sum(nil))
}
func HashUserNickname(nickname string) string {
return HashSHA3512(nickname)
}
func HashGroupName(groupname string) string {
return HashSHA3512(groupname)
}
func HashToken(token string) string {
return HashSHA3512(token)
}