Skip to content

Java, android, ios, get the same result by DES encryption and decryption.

License

Notifications You must be signed in to change notification settings

OctMon/flutter_des

Repository files navigation

Pub support build

flutter_des

Java, android, ios, get the same result by DES encryption and decryption.

DES Algorithm: CBC Operation: (android)PKCS5Padding (ios)kCCOptionPKCS7Padding http://tool.chacuo.net/cryptdes

Getting Started

Add dependency

dependencies:
  flutter_des: #latest version

Example

import 'package:flutter_des/flutter_des.dart';

void example() async {
  const string = "Java, android, ios, get the same result by DES encryption and decryption.";
  const key = "u1BvOHzUOcklgNpn1MaWvdn9DT4LyzSX";
  const iv = "12345678";

  var encrypt = await FlutterDes.encrypt(string, key, iv: iv);
  var decrypt = await FlutterDes.decrypt(encrypt, key, iv: iv);
  var encryptHex = await FlutterDes.encryptToHex(string, key, iv: iv);
  var decryptHex = await FlutterDes.decryptFromHex(encryptHex, key, iv: iv);
  var encryptBase64 = await FlutterDes.encryptToBase64(string, key, iv: iv);
  var decryptBase64 = await FlutterDes.decryptFromBase64(encryptBase64, key, iv: iv);
}