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

outdated

Cryptographic algorithms for encryption, digital signatures, key agreement, authentication, and hashing. AES, Chacha20, ED25519, X25519, and more. Web Crypto support.

example/lib/example.dart

import 'package:cryptography/cryptography.dart';

Future<void> main() async {
  // Generate a random 256-bit secret key
  final secretKey = await chacha20.newSecretKey();

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

  // Encrypt
  final plainText = [1, 2, 3];
  final cipherText = await chacha20Poly1305Aead.encrypt(
    plainText,
    secretKey: secretKey,
    nonce: nonce,
  );

  print('Bytes: ${chacha20Poly1305Aead.getDataInCipherText(cipherText)}');
  print('MAC: ${chacha20Poly1305Aead.getMacInCipherText(cipherText)}');
}
287
likes
40
points
382k
downloads

Publisher

verified publisherdint.dev

Weekly Downloads

Cryptographic algorithms for encryption, digital signatures, key agreement, authentication, and hashing. AES, Chacha20, ED25519, X25519, and more. Web Crypto support.

Repository (GitHub)

License

Apache-2.0 (license)

Dependencies

collection, crypto, fixnum, js, meta, typed_data

More

Packages that depend on cryptography