deriveKey method
Gets the key and iv
Implementation
KeyIV deriveKey(String password, {Uint8List? salt}) {
Uint8List pwBytes = NanoHelpers.stringToBytesUtf8(password);
Uint8List saltBytes = salt == null ? Uint8List(1) : salt;
// Key = sha256 (password + salt);
Uint8List key = Sha.sha256([pwBytes, saltBytes]);
// iv = sha256 (KEY + password + salt);
Uint8List iv = Sha.sha256([key, pwBytes, saltBytes]).sublist(0, 16);
return KeyIV(key, iv);
}