Security & Identity — Crypto You Can Trust
Security code is where 'roll your own' is scariest — so this family sticks to standard, RFC-verified algorithms, tested against the official vectors, with no dependencies to compromise.
Cryptography is the one place where writing your own is genuinely dangerous — subtle mistakes are invisible and catastrophic. The Larz Stack's security family doesn't invent algorithms; it implements the standard ones correctly and proves it against the official RFC test vectors. You get hashing, encryption, secrets management, two-factor auth and identity — all pure Python, all checkable.
The security family
Each library covers a distinct security job, and each is tested against published vectors.
| Library | What it does |
|---|---|
| larzcrypt | Hashes/HMAC, KDFs (PBKDF2/scrypt/HKDF), ChaCha20-Poly1305, X25519, Ed25519, JWT |
| larzvault | Encrypted secrets store (scrypt master key + authenticated encryption) |
| larztotp | TOTP/HOTP two-factor auth + provisioning URIs (RFC 6238/4226) |
| larzqr | QR codes from scratch (Reed-Solomon ECC) — turn a 2FA URI into a scannable code |
| larzid | Self-certifying DIDs + verifiable credentials (Ed25519) |
The theme: standard algorithms, verified. larzcrypt matches RFC 8439/7748/8032; larztotp matches RFC 6238; larzqr matches the QR spec's own test vectors.
Correctness you can verify
The reason to trust these isn't a promise — it's that they reproduce the official answers. For example, larztotp generates the exact codes from the RFC's test table, and pairs with larzqr for enrollment.
from larztotp import TOTP
from larzqr import QR
totp = TOTP("JBSWY3DPEHPK3PXP")
totp.now() # 6-digit code, matches any authenticator app
uri = totp.provisioning_uri("alice", issuer="MyApp")
QR(uri).to_svg("enroll.svg") # scannable enrollment QR, no image libraryIdentity without a central authority
larzid builds on larzcrypt to give each user a self-certifying identity — a DID whose public key is its name — and verifiable credentials that anyone can check offline.
| Concept | What it means |
|---|---|
| DID (did:larz:...) | An identity you control, no central registry |
| Sign / verify | Prove a message came from that identity |
| Verifiable credential | A claim others can verify offline, with expiry |
| Tamper / forgery detection | Any change or fake fails verification |
This is the toolkit behind decentralised identity — useful for signed tokens, offline-verifiable passes, and the identity layer of blockchain apps like LarzChain.
🎯 Key takeaways
- The security family: larzcrypt (crypto toolkit), larzvault (secrets), larztotp (2FA), larzqr (QR), larzid (identity).
- It implements standard, RFC-verified algorithms — not home-grown crypto — and proves it against official vectors.
- larztotp + larzqr give you authenticator-app 2FA and scannable enrollment with no image library.
- The libraries are honest about their threat model: correct portable crypto, not side-channel-hardened like libsodium.
Frequently asked
Isn't 'rolling your own crypto' the classic mistake?
Inventing your own algorithm is the mistake. Implementing a standard, well-reviewed algorithm — and verifying it against the official test vectors — is how every crypto library is built. larzcrypt does exactly the latter: it's AES, ChaCha20-Poly1305, Ed25519 and friends, matching the RFC answers exactly. It's also honest that it isn't side-channel-hardened, so you can match it to the right use.
What's a self-certifying identity (DID)?
It's an identity whose name is derived from its own public key, so no central authority is needed to vouch for it — the identity certifies itself. You can sign messages as that identity and issue credentials others verify offline. larzid implements this on Ed25519, which is the foundation for decentralised identity and for signed, verifiable tokens in blockchain systems.
Related lessons
Data & Storage — Persisting Without a Server
Most apps don't need a database server on day one. This family gives you crash-safe storag…
Building with the Larz StackWeb, AI & Dev Tooling — the Everyday Kit
The libraries you reach for constantly — talking to the web, building AI agents, making CL…
Crypto & Web3Crypto Safety First: How Beginners Actually Lose Money (and How Not To)
Before you chase gains, learn to not get rekt. Most beginners don't lose money to the mark…