Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Rust implementation of the Noise Protocol Framework

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

mcginty/snow

Crates.ioDocs.rsBuild Statusdependency status

totally official snow logo

An implementation of Trevor Perrin'sNoise Protocol thatis designed to be Hard To Fuck Up™.

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

What's it look like?

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

letmut noise = snow::Builder::new("Noise_NN_25519_ChaChaPoly_BLAKE2s".parse()?).build_initiator()?;letmut buf =[0u8;65535];// write first handshake messagenoise.write_message(&[],&mut buf)?;// receive response messagelet incoming =receive_message_from_the_mysterious_ether();noise.read_message(&incoming,&mut buf)?;// complete handshake, and transition the state machine into transport modeletmut noise = noise.into_transport_mode()?;

See the full documentation athttps://docs.rs/snow.

Implemented

Snow is currently tracking againstNoise spec revision 34.

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

Crypto

Cryptographic providers are swappable throughBuilder::with_resolver(), but by defaultit chooses select, artisanal pure-Rust implementations (seeCargo.toml for a quickoverview).

Other Providers

ring

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

If you enable thering-resolver feature, Snow will include aresolvers::ring moduleas well as aRingAcceleratedResolver available to be used withBuilder::with_resolver().

If you enable thering-accelerated feature, Snow will default to choosingring'scrypto implementations when available.

Resolver primitives supported

defaultring
CSPRNG✔️✔️
25519✔️✔️
448
P-256🏁✔️
AESGCM✔️✔️
ChaChaPoly✔️✔️
XChaChaPoly🏁✔️
SHA256✔️✔️
SHA512✔️✔️
BLAKE2s✔️
BLAKE2b✔️

Note

🏁 P-256 and XChaChaPoly are not in the official specification of Noise, and thus need to be enabledvia the feature flagsuse-p256 anduse-xchacha20poly1305, respectively.

no_std support and feature selection

Snow can be used inno_std environments ifalloc is provided.

By default, Snow uses the standard library, default crypto resolver and a selected collectionof crypto primitives. To use Snow inno_std environments or make other kinds of customizedsetups, use Snow withdefault-features = false. This way you will individually selectthe components you wish to use.default-resolver is the only built-in resolver thatcurrently supportsno_std.

To use a custom setup withdefault-resolver, enable your desired selection of cryptographic primitives:

PrimitiveFeature flag
DHsCurve25519use-curve25519
P-256🏁use-p256
CiphersAES-GCMuse-aes-gcm
ChaChaPolyuse-chacha20poly1305
XChaChaPoly🏁use-xchacha20poly1305
HashesSHA-256use-sha2
SHA-512use-sha2
BLAKE2suse-blake2
BLAKE2buse-blake2

Note

🏁 XChaChaPoly and P-256 are not in the official specification of Noise, but they are supportedby Snow.

Example configurations

Curve25519 + AES-GCM + SHA-2 with standard library features.

default-features =falsefeatures = ["use-curve25519","use-aes-gcm","use-sha2","std",]

Curve25519 + ChaChaPoly + BLAKE2 without standard library.

default-features =falsefeatures = ["use-curve25519","use-chacha20poly1305","use-blake2",]

getrandom support

Most crypto implementations supported bydefault-resolver will requiregetrandom.

If your target platform is not directly supportedyou might have to provide a custom implementation in your crate root.Check out theirdocumentation for details.

License

snow is offered with a dual choice-of-license between:

where you may choose either of these licenses to follow for this work.

Contribution

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


[8]ページ先頭

©2009-2025 Movatter.jp