decryptData static method

Future<String> decryptData(
  1. String encryptedText,
  2. String password
)

Implementation

static Future<String> decryptData(String encryptedText, String password) async {
  final key = encrypt.Key(Uint8List.fromList(sha256.convert(utf8.encode(password)).bytes));
  final encrypter = encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.ecb));
  final decrypted = encrypter.decrypt16(encryptedText, iv: encrypt.IV.fromLength(0));
  return decrypted;
}