如何在Flutter / Dart中进行Blowfish CBC解密?我找不到任何支持它的库。
dbcrypt
仅支持密码哈希,不支持cbc模式。
谢谢。
答案 0 :(得分:1)
import 'package:encrypt/encrypt.dart' as encrypt;
import 'package:encrypt/encrypt.dart';
class _MyHomePageState extends State<MyHomePage> {
final plainText = 'some plain text here';
final key = encrypt.Key.fromUtf8('16 characters key');
final iv = IV.fromLength(16);
final encrypter = Encrypter(AES(key,mode: AESMode.cbc,padding: 'PKCS7'));
final encrypted = encrypter.encrypt(plainText, iv: iv);
final decrypted = encrypter.decrypt(encrypted, iv: iv);
print(decrypted);
print(encrypted.base64);
pubspec.yaml:
dependencies:
encrypt: ^4.0.0