encryptData static method

Future<String> encryptData(
  1. String text,
  2. String password
)

Implementation

static Future<String> encryptData(String text, 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 encrypted = encrypter.encrypt(text, iv: encrypt.IV.fromLength(0));
  return encrypted.base16;
}