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:
25
utils/hash.go
Normal file
25
utils/hash.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user