Documentation
ยถ
Overview ยถ
QuarkDash Module
@git https://github.com/devsdaddy/quarkdash-go @version 1.2.1 @author Elijah Rastorguev @build 1023 @website https://dev.to/devsdaddy @updated 28.08.2026
QuarkDash Implementation ยถ
@git https://github.com/devsdaddy/quarkdash-go @version 1.2.1 @author Elijah Rastorguev @build 1023 @website https://dev.to/devsdaddy @updated 28.08.2026
Index ยถ
- Constants
- Variables
- func Argon2idSync(pass string, salt []byte, mc, tc, dkLen int) []byte
- func Argon2idSyncBytes(pass, salt []byte, mc, tc, dkLen int) []byte
- func BytesToHex(b []byte) string
- func BytesToText(b []byte) string
- func ConcatBytes(arrays ...[]byte) []byte
- func DeriveKeyForQuarkDash(pass string, salt []byte, opts PassphraseOptions) (sess, mac []byte)
- func DerivePassphrase(pass string, opts PassphraseOptions) (key, salt []byte)
- func GenerateSalt(length int) []byte
- func PBKDF2Sync(pass string, salt []byte, iter, dkLen int) []byte
- func PBKDF2SyncBytes(pass, salt []byte, iter, dkLen int) []byte
- func RandomBytes(n int) []byte
- func SHA256Hash(data []byte) []byte
- func SHA512Hash(data []byte) []byte
- func SecureZeroBytes(b []byte)
- func Shake256Hash(data []byte, outLen int) []byte
- func TextToBytes(s string) []byte
- func WithCipher(ct CipherType) func(*Options)
- func WithKDF(k KDF) func(*Options)
- func WithKeyExchange(kx KeyExchange) func(*Options)
- func WithMAC(m MAC) func(*Options)
- func WithMaxPacketWindow(n int) func(*Options)
- func WithRekeyPolicy(p RekeyPolicy) func(*Options)
- func WithTimestampToleranceMs(n int64) func(*Options)
- func WithUsePerMessageNonce(v bool) func(*Options)
- type BaseRingLWE
- type ChaChaKeystream
- type Cipher
- type CipherType
- type Encryptor
- type GimliKeystream
- type GrpcCall
- type KDF
- type KeyExchange
- type MAC
- type NTTProtectionOptions
- type Options
- type PassphraseOptions
- type QDGRPC
- type QDHTTP
- type QDHTTPOptions
- type QDWebSocket
- type QuarkDash
- func (qd *QuarkDash) ApplyRekey(token []byte) error
- func (qd *QuarkDash) Decrypt(ciphertext []byte) ([]byte, error)
- func (qd *QuarkDash) Dispose()
- func (qd *QuarkDash) Encrypt(plaintext []byte) ([]byte, error)
- func (qd *QuarkDash) FinalizeSession(ciphertext []byte) error
- func (qd *QuarkDash) GenerateKeyPair() []byte
- func (qd *QuarkDash) GetMacKey() []byte
- func (qd *QuarkDash) GetRekeyCounter() int
- func (qd *QuarkDash) GetRekeyStats() (counter, bytesEnc, messagesEnc int, lastRekey time.Time, policy RekeyPolicy)
- func (qd *QuarkDash) GetSessionKey() []byte
- func (qd *QuarkDash) InitializeSession(peerPublicKey []byte, isInitiator bool) ([]byte, error)
- func (qd *QuarkDash) NeedsRekey() bool
- func (qd *QuarkDash) Rekey() ([]byte, error)
- func (qd *QuarkDash) SetRekeyPolicy(p RekeyPolicy)
- type QuarkDashChaCha
- type QuarkDashGimli
- type QuarkDashKDF
- type QuarkDashMAC
- type QuarkDashRLWE
- type QuarkDashRRLWE
- type RRLWE
- type RekeyOptions
- type RekeyPolicy
- type RingLWE
- type WSLike
Constants ยถ
const ( CipherChaCha20 = cipher.CipherChaCha20 CipherGimli = cipher.CipherGimli )
Variables ยถ
var ( ErrSessionNotEstablished = errors.New("session not established") ErrSessionNotInitialized = errors.New("session not initialized") ErrMACVerificationFailed = errors.New("MAC verification failed") ErrTimestampOutOfWindow = errors.New("timestamp out of window") ErrReplayDetected = errors.New("replay detected") ErrRekeyCounterMismatch = errors.New("rekey counter mismatch") ErrInvalidNonce = errors.New("nonce must be 12 bytes") ErrInvalidCiphertext = errors.New("invalid ciphertext") )
var DefaultNTTProtection = ringlwe.DefaultNTTProtection
var DefaultRekeyPolicy = rekey.DefaultRekeyPolicy
Functions ยถ
func Argon2idSyncBytes ยถ
func BytesToHex ยถ
func BytesToText ยถ
func ConcatBytes ยถ
func DeriveKeyForQuarkDash ยถ
func DeriveKeyForQuarkDash(pass string, salt []byte, opts PassphraseOptions) (sess, mac []byte)
func DerivePassphrase ยถ
func DerivePassphrase(pass string, opts PassphraseOptions) (key, salt []byte)
func GenerateSalt ยถ
func PBKDF2SyncBytes ยถ
func RandomBytes ยถ
func SHA256Hash ยถ
func SHA512Hash ยถ
func SecureZeroBytes ยถ
func SecureZeroBytes(b []byte)
func Shake256Hash ยถ
============================================================================= Hashes =============================================================================
func TextToBytes ยถ
============================================================================= Re-export core utils =============================================================================
func WithCipher ยถ
func WithCipher(ct CipherType) func(*Options)
func WithKeyExchange ยถ
func WithKeyExchange(kx KeyExchange) func(*Options)
func WithMaxPacketWindow ยถ
func WithRekeyPolicy ยถ
func WithRekeyPolicy(p RekeyPolicy) func(*Options)
func WithUsePerMessageNonce ยถ
Types ยถ
type BaseRingLWE ยถ
type BaseRingLWE = ringlwe.BaseRingLWE
============================================================================= Ring LWE =============================================================================
type ChaChaKeystream ยถ
type ChaChaKeystream = cipher.ChaChaKeystream
type GimliKeystream ยถ
type GimliKeystream = cipher.GimliKeystream
type KeyExchange ยถ
type KeyExchange interface {
GenerateKeyPair() (pub, priv []byte)
Encapsulate(pubKey []byte) (ciphertext, sharedSecret []byte, err error)
Decapsulate(privKey, peerPubKey, ciphertext []byte) ([]byte, error)
}
KeyExchange - key exchange interface (KEM).
type NTTProtectionOptions ยถ
type NTTProtectionOptions = ringlwe.NTTProtectionOptions
NTTProtectionOptions - NTT security options
type Options ยถ
type Options struct {
Cipher CipherType
KDF KDF
MAC MAC
KeyExchange KeyExchange
MaxPacketWindow int
TimestampToleranceMs int64
Rekey RekeyOptions
UsePerMessageNonce bool
}
Options - basic QuarkDash configuration.
type PassphraseOptions ยถ
type PassphraseOptions = passphrase.PassphraseOptions
============================================================================= Passphrase =============================================================================
type QDHTTP ยถ
============================================================================= Transport wrappers - Lightweight transport =============================================================================
func NewQDHTTP ยถ
func NewQDHTTP(enc Encryptor, opts ...QDHTTPOptions) *QDHTTP
type QDHTTPOptions ยถ
type QDHTTPOptions = transport.QDHTTPOptions
type QDWebSocket ยถ
type QDWebSocket = transport.QDWebSocket
func NewQDWebSocket ยถ
func NewQDWebSocket(enc Encryptor, ws WSLike) *QDWebSocket
func WrapWebSocket ยถ
func WrapWebSocket(enc Encryptor, ws WSLike) *QDWebSocket
type QuarkDash ยถ
type QuarkDash struct {
// contains filtered or unexported fields
}
QuarkDash - general protocol class. Threadsafety (sync.Mutex), support per-message nonce, replay-security and rekey (key rotation).
func (*QuarkDash) ApplyRekey ยถ
ApplyRekey apply key rotation token from peer (decrypt using old session, when derive).
func (*QuarkDash) FinalizeSession ยถ
FinalizeSession complete handshake on receiver side.
func (*QuarkDash) GenerateKeyPair ยถ
GenerateKeyPair generates key pair (pub 1024B, private 512B).
func (*QuarkDash) GetRekeyCounter ยถ
GetRekeyCounter return key rotation counter.
func (*QuarkDash) GetRekeyStats ยถ
func (qd *QuarkDash) GetRekeyStats() (counter, bytesEnc, messagesEnc int, lastRekey time.Time, policy RekeyPolicy)
GetRekeyStats return key rotation static.
func (*QuarkDash) GetSessionKey ยถ
GetSessionKey / GetMacKey - for tests/debugging.
func (*QuarkDash) InitializeSession ยถ
InitializeSession start a handshake. If isInitiator=true, return ciphertext to send to peer.
func (*QuarkDash) NeedsRekey ยถ
NeedsRekey checks, need key rotation or not using current policy.
func (*QuarkDash) Rekey ยถ
Rekey generates a key rotation token (encrypt payload with old session, and derive new keys).
func (*QuarkDash) SetRekeyPolicy ยถ
func (qd *QuarkDash) SetRekeyPolicy(p RekeyPolicy)
SetRekeyPolicy update rotation policy.
type QuarkDashChaCha ยถ
type QuarkDashChaCha = cipher.QuarkDashChaCha
============================================================================= Ciphers (cipher) - re-export =============================================================================
func NewQuarkDashChaCha ยถ
func NewQuarkDashChaCha(key, nonce []byte) (*QuarkDashChaCha, error)
type QuarkDashGimli ยถ
type QuarkDashGimli = cipher.QuarkDashGimli
func NewQuarkDashGimli ยถ
func NewQuarkDashGimli(key, nonce []byte) (*QuarkDashGimli, error)
type QuarkDashKDF ยถ
type QuarkDashKDF = core.QuarkDashKDF
============================================================================= KDF / MAC =============================================================================
func NewQuarkDashKDF ยถ
func NewQuarkDashKDF() *QuarkDashKDF
type QuarkDashMAC ยถ
type QuarkDashMAC = core.QuarkDashMAC
func NewQuarkDashMAC ยถ
func NewQuarkDashMAC() *QuarkDashMAC
type QuarkDashRLWE ยถ
type QuarkDashRLWE = RingLWE
type QuarkDashRRLWE ยถ
type QuarkDashRRLWE = RRLWE
type RRLWE ยถ
func NewQuarkDashRRLWE ยถ
func NewQuarkDashRRLWE() *RRLWE
type RekeyOptions ยถ
type RekeyOptions struct {
Policy RekeyPolicy
AutoRekey bool
OnRekey func(counter int)
}
RekeyOptions - key rotation options.
type RingLWE ยถ
func NewQuarkDashRLWE ยถ
func NewQuarkDashRLWE() *RingLWE
func NewRingLWE ยถ
func NewRingLWE() *RingLWE
Directories
ยถ
| Path | Synopsis |
|---|---|
|
QuarkDash ChaCha20 Implementation
|
QuarkDash ChaCha20 Implementation |
|
QuarkDash KDF Implementation
|
QuarkDash KDF Implementation |
|
QuarkDash SHA Implementation
|
QuarkDash SHA Implementation |
|
QuarkDash Passphrase Implementation
|
QuarkDash Passphrase Implementation |
|
QuarkDash Key Rotation Implementation
|
QuarkDash Key Rotation Implementation |
|
QuarkDash Key Ring-LWE Implementation
|
QuarkDash Key Ring-LWE Implementation |
|
QuarkDash gRPC Wrapper
|
QuarkDash gRPC Wrapper |
