Golang
Golang Code Snippet
Hash Email and Phone Number
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
)
func main() {
email := "[email protected]"
phone := "+1234567890"
// Hash email
emailHash := hashSHA256(email)
fmt.Println("Hashed email:", emailHash)
// Hash phone number
phoneHash := hashSHA256(phone)
fmt.Println("Hashed phone number:", phoneHash)
}
// Function to hash using SHA-256
func hashSHA256(input string) string {
hasher := sha256.New()
hasher.Write([]byte(input))
hashed := hasher.Sum(nil)
return hex.EncodeToString(hashed)
}
Encrypt Signed body
Last updated