rusty_chacha_dart 0.7.2 copy "rusty_chacha_dart: ^0.7.2" to clipboard
rusty_chacha_dart: ^0.7.2 copied to clipboard

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

example/lib/main.dart

import 'dart:typed_data';

import 'package:collection/collection.dart';
import 'package:rusty_chacha_dart/rusty_chacha_dart.dart';

void main() async {
  final data = Uint8List.fromList([1, 2, 3, 4, 5]);
  print('data: $data');

  // Create and use a ChaCha20Poly1305 cipher with a random key:
  RustyChaCha20Poly1305 cipher = await RustyChaCha.create();

  Uint8List encrypted = await cipher.encrypt(cleartext: data);
  print('encrypted: $encrypted');

  Uint8List decrypted = await cipher.decrypt(ciphertext: encrypted);
  print('decrypted: $decrypted');

  assert(const ListEquality().equals(data, decrypted));
}
0
likes
130
points
87
downloads

Publisher

verified publisher32k.eu

Weekly Downloads

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

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

ffi, flutter_rust_bridge, freezed_annotation

More

Packages that depend on rusty_chacha_dart