cryptography 2.9.0 copy "cryptography: ^2.9.0" to clipboard
cryptography: ^2.9.0 copied to clipboard

Cryptographic algorithms for encryption, digital signatures, key agreement, authentication, and hashing. AES, Chacha20, ED25519, and more. Cross-platform (mobile, desktop, JS, WASM).

example/lib/example.dart

import 'package:cryptography/cryptography.dart';

Future<void> main() async {
  final algorithm = AesGcm.with256bits();

  // Generate a random 256-bit secret key
  final secretKey = await algorithm.newSecretKey();

  // Generate a random 96-bit nonce.
  final nonce = algorithm.newNonce();

  // Encrypt
  final clearText = [1, 2, 3];
  final secretBox = await algorithm.encrypt(
    clearText,
    secretKey: secretKey,
    nonce: nonce,
  );
  print('Ciphertext: ${secretBox.cipherText}');
  print('MAC: ${secretBox.mac}');
}
291
likes
150
points
290k
downloads

Publisher

verified publisherdint.dev

Weekly Downloads

Cryptographic algorithms for encryption, digital signatures, key agreement, authentication, and hashing. AES, Chacha20, ED25519, and more. Cross-platform (mobile, desktop, JS, WASM).

Repository (GitHub)
View/report issues

Topics

#crypto

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

collection, crypto, ffi, meta, typed_data

More

Packages that depend on cryptography