runtimelib

package
v0.0.0-...-d6b0b83 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(ciphertextBase64, keyHex string) (string, error)

AESDecrypt decrypts data using AES-GCM with derived key

func AESEncrypt

func AESEncrypt(plaintext, keyHex string) (string, error)

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

func BcryptHash(password string, cost int) (string, error)

BcryptHash implements Bcrypt password hashing

func BcryptVerify

func BcryptVerify(password, hash string) bool

BcryptVerify verifies a password against a Bcrypt hash

func DeriveKeyFromSharedSecret

func DeriveKeyFromSharedSecret(sharedSecretHex, salt, info string, keyLength int) ([]byte, error)

DeriveKey derives a symmetric key from shared secret using HKDF

func GenerateSalt

func GenerateSalt(length int) (string, error)

GenerateSalt generates a cryptographically secure random salt

func GenerateSelfSignedCertificate

func GenerateSelfSignedCertificate() ([]byte, []byte, error)

GenerateCertificateRequest creates a self-signed certificate for TLS

func HMACSHA256

func HMACSHA256(message, key string) string

HMACSHA256 computes HMAC-SHA256

func HMACSHA512

func HMACSHA512(message, key string) string

HMACSHA512 computes HMAC-SHA512

func HashPassword

func HashPassword(password string) (string, string, error)

HashPassword provides a unified interface for password hashing (defaults to Argon2id)

func MD5Hex

func MD5Hex(s string) string

MD5Hex returns MD5 hash as hex

func OWASPHashPassword

func OWASPHashPassword(password string) (string, error)

OWASPHashPassword creates OWASP-compliant password hash using Argon2id

func OWASPVerifyPassword

func OWASPVerifyPassword(password, storedHash string) bool

OWASPVerifyPassword verifies OWASP-compliant password hash

func PBKDF2Hash

func PBKDF2Hash(password, salt string, iterations, keyLength int) (string, error)

PBKDF2Hash implements PBKDF2-HMAC-SHA256 password hashing

func PBKDF2Verify

func PBKDF2Verify(password, salt, hash string, iterations, keyLength int) bool

PBKDF2Verify verifies a password against a PBKDF2 hash

func SHA1Hex

func SHA1Hex(s string) string

SHA1Hex returns SHA1 hash as hex

func SHA224Hex

func SHA224Hex(s string) string

SHA224Hex returns the SHA224 hash of a string as hex

func SHA256Hex

func SHA256Hex(s string) string

SHA256Hex returns SHA256 hash as hex

func SHA384Hex

func SHA384Hex(s string) string

SHA384Hex returns the SHA384 hash of a string as hex

func SHA512Hex

func SHA512Hex(s string) string

SHA512Hex returns SHA512 hash as hex

func ScryptHash

func ScryptHash(password, salt string, N, r, p, keyLength int) (string, error)

ScryptHash implements Scrypt password hashing

func ScryptVerify

func ScryptVerify(password, salt, hash string, N, r, p, keyLength int) bool

ScryptVerify verifies a password against a Scrypt hash

func VerifyPassword

func VerifyPassword(password, hash, salt, algorithm string) bool

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

func (d *DHEKeyExchange) SetPeerPublicKey(peerPublicKeyHex string) error

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

func NewECDHEKeyExchange(curveName string) (*ECDHEKeyExchange, error)

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

func (e *ECDHEKeyExchange) SetPeerPublicKey(peerPublicKeyHex string) error

SetPeerPublicKey sets the peer's public key and computes shared secret

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL