Dart/Flutter 河豚 CBC
Dart/Flutter Blowfish CBC
如何在Flutter/Dart中进行Blowfish CBC解密?我找不到任何支持它的库。
dbcrypt
仅支持密码散列,不支持 cbc 模式。
谢谢。
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
如何在Flutter/Dart中进行Blowfish CBC解密?我找不到任何支持它的库。
dbcrypt
仅支持密码散列,不支持 cbc 模式。
谢谢。
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