cryptography 2.0.0-nullsafety.2 copy "cryptography: ^2.0.0-nullsafety.2" to clipboard
cryptography: ^2.0.0-nullsafety.2 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 {
  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}');
}
245
likes
0
pub points
98%
popularity

Publisher

verified publisherdint.dev

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

collection, crypto, fixnum, js, meta, typed_data

More

Packages that depend on cryptography