#noise #protocols #crypto

snow

A pure-rust implementation of the Noise Protocol Framework

53 releases

0.9.6 Jan 26, 2024
0.9.4 Nov 11, 2023
0.9.2 Mar 13, 2023
0.9.0 Feb 3, 2022
0.0.1-preview.10 Mar 21, 2017

#31 in Cryptography

Download history 89210/week @ 2023-12-06 82497/week @ 2023-12-13 50524/week @ 2023-12-20 34890/week @ 2023-12-27 71827/week @ 2024-01-03 78437/week @ 2024-01-10 95110/week @ 2024-01-17 94520/week @ 2024-01-24 82755/week @ 2024-01-31 89319/week @ 2024-02-07 99961/week @ 2024-02-14 103888/week @ 2024-02-21 98410/week @ 2024-02-28 100985/week @ 2024-03-06 90545/week @ 2024-03-13 89901/week @ 2024-03-20

399,605 downloads per month
Used in 331 crates (37 directly)

Apache-2.0 OR MIT

615KB
3.5K SLoC

Snow

Crates.io Docs.rs Build Status dependency status

totally official snow logo

An implementation of Trevor Perrin's Noise Protocol that is designed to be Hard To Fuck Upâ„¢.

🔥 Warning 🔥 This library has not received any formal audit.

What's it look like?

See examples/simple.rs for a more complete TCP client/server example.

let mut noise = snow::Builder::new("Noise_NN_25519_ChaChaPoly_BLAKE2s".parse()?)
                    .build_initiator()?;

let mut buf = [0u8; 65535];

// write first handshake message
noise.write_message(&[], &mut buf)?;

// receive response message
let incoming = receive_message_from_the_mysterious_ether();
noise.read_message(&incoming, &mut buf)?;

// complete handshake, and transition the state machine into transport mode
let mut noise = noise.into_transport_mode()?;

See the full documentation at https://docs.rs/snow.

Implemented

Snow is currently tracking against Noise spec revision 34.

However, a not all features have been implemented yet (pull requests welcome):

Crypto

Cryptographic providers are swappable through Builder::with_resolver(), but by default it chooses select, artisanal pure-Rust implementations (see Cargo.toml for a quick overview).

Other Providers

ring

ring is a crypto library based off of BoringSSL and is significantly faster than most of the pure-Rust implementations.

If you enable the ring-resolver feature, Snow will include a resolvers::ring module as well as a RingAcceleratedResolver available to be used with Builder::with_resolver().

If you enable the ring-accelerated feature, Snow will default to choosing ring's crypto implementations when available.

Resolver primitives supported

default ring
CSPRNG ✔ ✔
25519 ✔ ✔
448
AESGCM ✔ ✔
ChaChaPoly ✔ ✔
SHA256 ✔ ✔
SHA512 ✔ ✔
BLAKE2s ✔
BLAKE2b ✔

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.1–19MB
~238K SLoC