OctMon / flutter_des

Java, android, ios, get the same result by DES encryption and decryption.
MIT License
14 stars 15 forks source link
crypto decrypt des encrypt flutter

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);
}