Skip to content

Instantly share code, notes, and snippets.

@ctkqiang
Last active May 3, 2020 19:10
Show Gist options
  • Save ctkqiang/700440e798f7aa853106dcea36204e64 to your computer and use it in GitHub Desktop.
Save ctkqiang/700440e798f7aa853106dcea36204e64 to your computer and use it in GitHub Desktop.
Hey guys am i doing it right or wrong? My intention is to decode hashes I just encoded of an image. How do I decode ? My code Need reviewed .
//encode:
Future<void> _encryptionBinary() async {
int x = 0;
int y = 100;
print("Please Enter {content} you want to encrypt: ");
String _requestUserFileInput = IO.stdin.readLineSync();
List _binary = await new IO.File(_requestUserFileInput).readAsBytesSync();
String _encodedFile = base64.encode(_binary);
print("Encoded Binary: $_encodedFile".substring(x, y));
}
// encode output, lets say b'fftviuynpoiupiuniunsadsadasdsdasdoiufdiytpiu=='
// intention: decode hashes and export to file("picture_name.extension");
//decode:
Future<void> __decryption_Binary() async {
// To be Reviewed:
var _decodedBytes;
var _file;
print("Please Enter {content} you want to decrypt: ");
String _requestUserFileInput = IO.stdin.readLineSync();
List _binary = await new IO.File(_requestUserFileInput).readAsBytesSync();
String _encodedFile = base64.encode(_binary);
_decodedBytes = base64Decode(_encodedFile);
print("Decoded Binary: $_encodedFile");
_file = IO.File("output.png");
_file.writeAsBytesSync(_decodedBytes);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment