Documentation
¶
Index ¶
- func AESDecrypt(ciphertextBase64, keyHex string) (string, error)
- func AESEncrypt(plaintext, keyHex string) (string, error)
- func Argon2idHash(password, salt string, iterations, memory, parallelism, keyLength int) (string, error)
- func Argon2idVerify(password, salt, hash string, iterations, memory, parallelism, keyLength int) bool
- func BcryptHash(password string, cost int) (string, error)
- func BcryptVerify(password, hash string) bool
- func DeriveKeyFromSharedSecret(sharedSecretHex, salt, info string, keyLength int) ([]byte, error)
- func GenerateSalt(length int) (string, error)
- func GenerateSelfSignedCertificate() ([]byte, []byte, error)
- func HMACSHA256(message, key string) string
- func HMACSHA512(message, key string) string
- func HashPassword(password string) (string, string, error)
- func MD5Hex(s string) string
- func OWASPHashPassword(password string) (string, error)
- func OWASPVerifyPassword(password, storedHash string) bool
- func PBKDF2Hash(password, salt string, iterations, keyLength int) (string, error)
- func PBKDF2Verify(password, salt, hash string, iterations, keyLength int) bool
- func SHA1Hex(s string) string
- func SHA224Hex(s string) string
- func SHA256Hex(s string) string
- func SHA384Hex(s string) string
- func SHA512Hex(s string) string
- func ScryptHash(password, salt string, N, r, p, keyLength int) (string, error)
- func ScryptVerify(password, salt, hash string, N, r, p, keyLength int) bool
- func VerifyPassword(password, hash, salt, algorithm string) bool
- type DHEKeyExchange
- type ECDHEKeyExchange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESDecrypt ¶
AESDecrypt decrypts data using AES-GCM with derived key
func AESEncrypt ¶
AESEncrypt encrypts data using AES-GCM with derived key
func Argon2idHash ¶
func Argon2idHash(password, salt string, iterations, memory, parallelism, keyLength int) (string, error)
Argon2idHash implements Argon2id password hashing (OWASP recommended)
func Argon2idVerify ¶
func Argon2idVerify(password, salt, hash string, iterations, memory, parallelism, keyLength int) bool
Argon2idVerify verifies a password against an Argon2id hash
func BcryptHash ¶
BcryptHash implements Bcrypt password hashing
func BcryptVerify ¶
BcryptVerify verifies a password against a Bcrypt hash
func DeriveKeyFromSharedSecret ¶
DeriveKey derives a symmetric key from shared secret using HKDF
func GenerateSalt ¶
GenerateSalt generates a cryptographically secure random salt
func GenerateSelfSignedCertificate ¶
GenerateCertificateRequest creates a self-signed certificate for TLS
func HashPassword ¶
HashPassword provides a unified interface for password hashing (defaults to Argon2id)
func OWASPHashPassword ¶
OWASPHashPassword creates OWASP-compliant password hash using Argon2id
func OWASPVerifyPassword ¶
OWASPVerifyPassword verifies OWASP-compliant password hash
func PBKDF2Hash ¶
PBKDF2Hash implements PBKDF2-HMAC-SHA256 password hashing
func PBKDF2Verify ¶
PBKDF2Verify verifies a password against a PBKDF2 hash
func ScryptHash ¶
ScryptHash implements Scrypt password hashing
func ScryptVerify ¶
ScryptVerify verifies a password against a Scrypt hash
func VerifyPassword ¶
VerifyPassword provides a unified interface for password verification
Types ¶
type DHEKeyExchange ¶
type DHEKeyExchange struct {
// contains filtered or unexported fields
}
DHEKeyExchange represents a DHE key exchange session
func NewDHEKeyExchange ¶
func NewDHEKeyExchange() (*DHEKeyExchange, error)
NewDHEKeyExchange creates a new DHE key exchange session
func (*DHEKeyExchange) GetPublicKey ¶
func (d *DHEKeyExchange) GetPublicKey() string
GetPublicKey returns the public key in hex format
func (*DHEKeyExchange) GetSharedSecret ¶
func (d *DHEKeyExchange) GetSharedSecret() string
GetSharedSecret returns the computed shared secret in hex format
func (*DHEKeyExchange) SetPeerPublicKey ¶
SetPeerPublicKey sets the peer's public key and computes shared secret
type ECDHEKeyExchange ¶
type ECDHEKeyExchange struct {
// contains filtered or unexported fields
}
ECDHEKeyExchange represents an ECDHE key exchange session
func NewECDHEKeyExchange ¶
NewECDHEKeyExchange creates a new ECDHE key exchange session
func (*ECDHEKeyExchange) GetPublicKey ¶
func (e *ECDHEKeyExchange) GetPublicKey() string
GetPublicKey returns the public key in hex format
func (*ECDHEKeyExchange) GetSharedSecret ¶
func (e *ECDHEKeyExchange) GetSharedSecret() string
GetSharedSecret returns the computed shared secret in hex format
func (*ECDHEKeyExchange) SetPeerPublicKey ¶
SetPeerPublicKey sets the peer's public key and computes shared secret