<div dir="auto"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="auto"><div dir="ltr"><div dir="ltr"><div dir="auto">Hi Noise,<div dir="auto"><br></div><div dir="auto">I published <a href="https://github.com/tgalal/dissononce" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">dissononce</a>; a python implementation for Noise based on revision 34. I'm aware of <a href="https://github.com/plizonczyk/noiseprotocol" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">Piotr's also python implementation</a>, which is great and a very helpful reference. However I had a slightly different idea for what a python implementation for Noise could look like. </div><div dir="auto"><br></div><div dir="auto">- I went for pushing and preferring a more verbose composition-style of Noise Protocols rather than resolving using string names.</div><div dir="auto">- It's intended by this implementation to also be a simple to understand practical reference
to Noise spec, therefore the library tries to segregate Noise spec implementation from any own features of the lib.</div><div dir="auto">- A verbose package structure to ease navigation for someone learning about Noise.</div><div>- Implementations for crypto algorithms are organized under stable/experimental/dangerous categories.</div><div><div dir="auto">- Flexible Pattern modifiers; a Pattern Modifier
modifies a given Handshake Pattern rather than a Handshake Pattern modifying
itself based on a given Pattern Modifier's name.</div><div dir="auto">- Access to underlying crypto primitives and providers is abstracted,
resulting in crypto backend flexibility where an
explicitly defined backend is unnecessary.</div><div dir="auto"><div dir="auto">- No limitations imposed by the library itself on
supported python versions. It's up to underlying dependencies which at
the moment happily work on python 2.5-3.7</div><div dir="auto"><br></div><div>code on github: <a href="https://github.com/tgalal/dissononce" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://github.com/tgalal/dissononce</a></div><div>published on pypi: <a href="https://pypi.org/project/dissononce/" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://pypi.org/project/dissononce</a><br></div></div></div><div><br></div><div>Side note: I think the concepts of defining, modifying and processing tokens could be done in a kind of more "autonomous" way where a defined token also has some associated "token processor" defined. The token processor is then what takes care of updating the HandshakeState depending on the token's meaning. This kind of separation between token processing and HandshakeState could allow for flexibility adopting new (and experimental) tokens, even those which don't officially exist Noise spec, without having to diverge HandshakeState implementations from the official spec in order to include processing rules for those tokens. Implementation-wise I'm still thinking of the How as this might introduce complexities understanding the code which I'd like to avoid. Anyways, only an idea for now.</div><div><br></div><div dir="auto">Finally a question; I was trying to plug in a DH functions implementation based on pynacl when I found that the shared secrets it calculates are not consistent with those produced by cryptography lib (uses OpenSSL v1.1 as backend I believe) for the same keypairs and of course fail the tests. I'm not a cryptographer myself so it's a bit hard to pin point the exact reason. This is <a href="https://pynacl.readthedocs.io/en/stable/public/#nacl-public-box" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">pynacl's docs about shared secrets</a> which fail and this is <a href="https://cryptography.io/en/latest/hazmat/primitives/asymmetric/x25519/#x25519-key-exchange" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">cryptography's key exchange docs</a> which succeed the tests. I'd appreciate any hints as it would be great if I could consider this in dissononce's design and docs. <br></div><div dir="auto"><br></div><div dir="auto">Feedback is very welcome, thanks!</div><div dir="auto"><br></div><div dir="auto"><br></div></div>
</div></div></div>
</div></div></div></div></div>