encrypt 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 98

encrypt #

Pub Package Build Status Donate

A set of high-level APIs over PointyCastle for two-way cryptography.

Looking for password hashing? Please, visit password.

AES (Block Cipher) #

import 'package:encrypt/encrypt.dart';

void main() {
  final key = 'my32lengthsupersecretnooneknows1';

  final encrypter = new Encrypter(new AES(key));
  final plainText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit ........';

  final encryptedText = encrypter.encrypt(plainText);
  final decryptedText = encrypter.decrypt(encryptedText);

  print(encryptedText); // db066ce180f62f020617eb720b891c1efcc48b217cb83272812a8efe3b30e7eae4373ddcede4ea77bdae77d126d95457b3759b1983bf4cb4a6a5b051a5690bdf
  print(decryptedText); // Lorem ipsum dolor sit amet, consectetur adipiscing elit ........
}

Salsa20 (Stream Cipher) #

import 'package:encrypt/encrypt.dart';

void main() {
  final key = 'private!!!!!!!!!';
  final iv = '8bytesiv'; // https://en.wikipedia.org/wiki/Initialization_vector
  final plainText = 'Secret';

  final encrypter = new Encrypter(new Salsa20(key, iv));

  final encrypted = encrypter.encrypt(plainText);
  final decrypted = encrypter.decrypt(encrypted);

  print(encrypted); // c5cc91943cf0
  print(decrypted); // Secret
}

Salsa20 With Chinese #

import 'package:encrypt/encrypt.dart';

void main() {
  final key = '1234567890123456';
  final iv = '8bytesiv';
  final encryptor = Encrypter(Salsa20(key, iv));
  String text = '你好';
  String base64Text = base64.encode(utf8.encode(text));
  String encText  = encryptor.encrypt(base64Text);
  var decStr = utf8.decode(base64.decode(encryptor.decrypt(encText)));

  print('origin:'+text);//你好
  print('base64Text:'+base64Text);//5L2g5aW9
  print('enc text:'+encText);//c72f29fd34b15145
  print('dec text:'+decStr);//你好
}

RSA (Asymmetric) #

TODO

0.2.0+2 #

  • Remove unnecessary news
  • Improve static typing
  • Add examples index (README)

0.2.0+1 #

  • Refresh dependencies, make sure it works on Dart 2.

example/README.md

Encrypt examples #

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  encrypt: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:encrypt/encrypt.dart';
  
Version Uploaded Documentation Archive
3.1.0 May 26, 2019 Go to the documentation of encrypt 3.1.0 Download encrypt 3.1.0 archive
3.0.0 Apr 23, 2019 Go to the documentation of encrypt 3.0.0 Download encrypt 3.0.0 archive
2.2.0 Apr 8, 2019 Go to the documentation of encrypt 2.2.0 Download encrypt 2.2.0 archive
2.1.0 Apr 3, 2019 Go to the documentation of encrypt 2.1.0 Download encrypt 2.1.0 archive
2.0.0 Feb 16, 2019 Go to the documentation of encrypt 2.0.0 Download encrypt 2.0.0 archive
1.0.1 Jan 17, 2019 Go to the documentation of encrypt 1.0.1 Download encrypt 1.0.1 archive
1.0.0+1 Dec 17, 2018 Go to the documentation of encrypt 1.0.0+1 Download encrypt 1.0.0+1 archive
1.0.0 Dec 17, 2018 Go to the documentation of encrypt 1.0.0 Download encrypt 1.0.0 archive
0.2.0+2 Oct 28, 2018 Go to the documentation of encrypt 0.2.0+2 Download encrypt 0.2.0+2 archive
0.2.0+1 Oct 28, 2018 Go to the documentation of encrypt 0.2.0+1 Download encrypt 0.2.0+1 archive

All 12 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
96
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
98
Learn more about scoring.

We analyzed this package on May 30, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.1
  • pana: 0.12.17

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:encrypt/encrypt.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
pointycastle ^1.0.0 1.0.1
Dev dependencies
test ^1.5.1+1