ahdinosaur / secret-channel Goto Github PK
View Code? Open in Web Editor NEW🤫 A protocol for an authenticated and encrypted message stream
🤫 A protocol for an authenticated and encrypted message stream
Rather than start our nonce with zero, there's a possible security gain (for the far-away future, since current 192-bit keys are considered secure even with simple counting nonces starting from zero) if we start our nonce with a preset (random) value.
This is what secret-handshake
and pull-box-stream
did. https://ssbc.github.io/scuttlebutt-protocol-guide/#box-stream
I'm not super convinced it's worth it. But maybe I'm wrong.
I see also that TLS has a counter that starts at zero, but XOR's that counter with a preset (random) value to construct the nonce.
Since content with zero-length should be disallowed anyways.
And then we skip all the type bit voodoo.
Looks like AEAD algorithms have usage limits: https://www.ietf.org/archive/id/draft-irtf-cfrg-aead-limits-07.html
ChaCha20-Poly1305's limit is 2^100
. Wait... that's plenty good.
But @noble/ciphers
says 2^46
: https://github.com/paulmillr/noble-ciphers#encryption-limits. Why the difference?
Will look into this more. If the limit is low enough, we could set a threshold to automatically re-key.
The idea would be to have the 96-bit nonce constructed similar to STREAM and libsodium's secretstream:
Not sure whether to use big endian or little endian.
My understanding is most CPUs are LE (so LE is more efficient), but network protocols are "supposed to be" BE. https://developer.mozilla.org/en-US/docs/Glossary/Endianness
One idea is we use little endian for the incrementing nonce (used internally), and big endian for the content length (sent over the network). Little endian for the nonce helps make incrementing with libsodium easy, because libsodium provides a increment
function which increments a little-endian buffer.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.