Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
add usege desc
  • Loading branch information
wanglulu committed Feb 22, 2020
1 parent 0654854 commit d8a0aaa
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,36 @@

## Usage

Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:

```
dependencies:
flutter_aes_ecb_pkcs5: ^0.1.1
```

2. Install it You can install packages from the command line:

with Flutter:

```
$ flutter pub get
```

Alternatively, your editor might support 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:flutter_aes_ecb_pkcs5/flutter_aes_ecb_pkcs5.dart';
```



#### AES Use Example


#### AES

```dart
import 'package:flutter_aes_ecb_pkcs5/flutter_aes_ecb_pkcs5.dart';
Expand All @@ -18,15 +46,15 @@ void main() {
var data = "{\"username\":\"helloword\"}";
//生成16字节的随机密钥
//generate a 16-byte random key
var key = await FlutterAesEcbPkcs5.generateDesKey(128);
print(key);
//加密
//encrypt
var encryptText = await FlutterAesEcbPkcs5.encryptString(data, key);
print(encryptText);
//解密
//decrypt
var decryptText = await FlutterAesEcbPkcs5.decryptString(encryptText, key);
print(decryptText);
Expand Down

0 comments on commit d8a0aaa

Please sign in to comment.