rusty_chacha 0.1.1-dev.2 copy "rusty_chacha: ^0.1.1-dev.2" to clipboard
rusty_chacha: ^0.1.1-dev.2 copied to clipboard

A Flutter library for fast ChaCha20-Poly1305 encryption, powered by Rust

Build Status Github Stars MIT License

Rusty ChaCha Banner

Rusty ChaCha 💃🦀 #

A Flutter library for fast ChaCha20-Poly1305 encryption, leveraging the capabilities of the Rust chacha20poly1305 crate.

🚧 Under Development: Not recommended for production use. 🚧


Features #

Blazingly fast 🔥 #

Thanks to Rust encryption and decryption with ChaCha20-Poly1305 run with at 500-1000 MiB/s. This is up to 50x faster than packages like cryptography_flutter or pointycastle.

Getting Started #

  • With Flutter, run flutter pub add rusty_chacha

Usage #

import 'package:rusty_chacha/rusty_chacha.dart';

main() async {
  await RustyChaCha.init();


  final key = await generateChaCha20Key(); // generate a random key
  final myData = Uint8List.fromList([1, 2, 3, 4, 5]);


  // basic example:
  final myEncryptedData = await encrypt(key: key, cleartext: myData);
  final myDataAgain1 = await decrypt(key: key, ciphertext: myEncryptedData);


  // compression example:
  final myCompressedAndEncryptedData = await encrypt(
    key: key,
    cleartext: myData,
    zstdCompressionLevel: 3, // moderate compression
  );
  final myDataAgain2 = await decrypt(key: key, ciphertext: myCompressedAndEncryptedData);


  // AAD example:
  final additionalData = Uint8List.fromList([1, 2, 3]); // some additional (non-secret) data
  final myEncryptedDataWithAad = await encrypt(
    key: key,
    cleartext: myData,
    aad: additionalData, // pass it in when encrypting
  );
  final myDataAgain3 = await decrypt(
    key: key,
    ciphertext: myEncryptedDataWithAad,
    aad: additionalData, // pass it in to decrypt (decrypt will fail if additionalData is not the same)
  );
}

Supported platforms (for now) #

  • iOS
  • MacOS
  • Windows
2
likes
0
pub points
73%
popularity

Publisher

verified publisher32k.eu

A Flutter library for fast ChaCha20-Poly1305 encryption, powered by Rust

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, ffi, flutter, flutter_rust_bridge, freezed_annotation, meta, path, path_provider, uuid

More

Packages that depend on rusty_chacha