Enchantrix/examples/hash/main.go
google-labs-jules[bot] 8082074054 docs: Add feature examples
Adds a comprehensive set of examples to demonstrate the library's features.

- Breaks out the existing `examples/main.go` into separate, well-named files.
- Adds new examples for hashing, checksums, RSA, and PGP.
- The PGP examples cover key generation, encryption/decryption, signing/verification, and symmetric encryption.
- Removes the old `examples/main.go` file and formats the new example files.
2025-11-13 19:37:35 +00:00

28 lines
500 B
Go

package main
import (
"fmt"
"github.com/Snider/Enchantrix/pkg/crypt"
)
func main() {
fmt.Println("--- Hashing Demo ---")
cryptService := crypt.NewService()
payload := "Enchantrix"
hashTypes := []crypt.HashType{
crypt.LTHN,
crypt.MD5,
crypt.SHA1,
crypt.SHA256,
crypt.SHA512,
}
fmt.Printf("Payload to hash: \"%s\"\n", payload)
for _, hashType := range hashTypes {
hash := cryptService.Hash(hashType, payload)
fmt.Printf(" - %-6s: %s\n", hashType, hash)
}
fmt.Println()
}