-
Notifications
You must be signed in to change notification settings - Fork 0
Algorithm overview
QuarkDash it is a hybrid cryptographic protocol (algorithm) that provides post-quantum security using Ring‑LWE, high performance, and attack resistance. QuarkDash Crypto combines asymmetric key exchange (sessions) and symmetric encryption via ChaCha20 (best for cross-platform development) or Gimli (best for IoT).
QuarkDash it is a hybrid post-quantum protocol that combines:
- Asymmetric key exchange based on Ring-LWE (resistant to quantum attacks);
- Symmetric encryption with a choice of stream ciphers (ChaCha20 or Gimli);
- Quantum-resistant KDF based on SHAKE256;
- Message authentication via SHAKE256-MAC;
- Protection against replay attacks using timestamps and sequence numbers;
This protocol is recommended for systems that require long-term data confidentiality (archives, financial transactions, government communications, AI RAG), as well as for high-load real-time applications.
- Quantum stability: not broken by Shor and Grover's algorithms;
- Performance: encryption up to 2.8 GB/s, session establishment ~3 ms;
- Forward secrecy: compromising a long-term key does not reveal past sessions;
-
Lazy keystream: seekable, cached, zero-copy XOR via
ChaChaKeystream/GimliKeystream; -
Re-keying (Key rotation):
rekey()/applyRekey()with policy by bytes / messages / time limit (order fixed: encrypt-then-derive); -
Passphrase: Human-readable
pbkdf2/argon2idlite keys andgenerateSalt(); - Hardened Secured NTT: blinding, double-check, constant-time, polynome validation, correct primitive roots, bit-reversed Cooley-Tukey and cross-rounding hint;
-
Transports: native simple wrappers for
WebSocket/gRPC/HTTPtransport; - Flexibility – ChaCha20/Gimli, sync and async API, per-message nonce;
Let's look at Step-by-step algorithm:
- Key pair generation (Ring-LWE):
- Select polynomials:
uniform a, smallsande. - Calculate
b = a ⊗ s + e. - Public key:
(a, b), private:s.
- Session establishment (KEM):
- Initiator (for example client):
-
- Generates small
s',e', calculatesu = a ⊗ s' + e'.
- Generates small
-
- Calculates
w = b ⊗ s', rounds to bits → shared secret ss.
- Calculates
-
- Sends
u(ciphertext + 32Bhint) = 544 bytes.
- Sends
- Recipient (for example server):
-
- Given
s, calculatesw' = u ⊗ s, rounds to bits → same ss.
- Given
-
- Extract
hintto apply for some errors.
- Extract
- Session Key Derivation (KDF):
-
keyMaterial= SHAKE256(salt || ss || "session-key", 64) with HKDF-like Extenstion:T(i) = SHAKE256(PRK || T(i-1) || info || i). - Apply deterministic salt (32 zero bytes).
- Split into
sessionKey (32 bytes)andmacKey (32 bytes). - When a session is finalized, the recipient's own public key is hashed (
decapsulate(myPublicKey)).
- Message Encryption (AEAD):
- A
header (12 bytes)is generated:timestamp (8) + sequence (4). - Encryption:
ciphertext = streamCipher.encrypt(plaintext)(XOR with gamma). -
mac = SHAKE256(macKey || header || ciphertext, 32). - Resulting message:
header||ciphertext||mac. - Key rotation (rekeying) is performed in the encrypt-then-derive order, which ensures that the token can be decrypted using old keys on both sides.
- Decryption:
- Header, ciphertext, and mac are extracted.
- The
mac(constant-time) is checked. - The timestamp (with a 5-minute tolerance) and sequence (for replay protection) are checked.
-
plaintext = streamCipher.decrypt(ciphertext).
More detailed infomration can be found here
Below is a simple explanation of the differences in cipher you can use in QuarkDash.
- State: 16 words of 32 bits.
- Rounds: 20.
- Gamma: 64 bytes per block.
- Features: Standardized (RFC 7539), high speed on all platforms, protection against timing attacks.
- State: 12 words of 32 bits.
- Rounds: 24.
- Gamma: 48 bytes per block.
- Features: Lightweight, designed for embedded systems, yet provides 256-bit security. NIST-audited.
Home | Get Started| NPM | Algorithm Overview | Contacts