Skip to content

Commit

Permalink
✨Implement ASCII viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhil-RGB committed Mar 23, 2023
1 parent e195aed commit cdfdb6d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/pages/EncrypterPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class _EncrypterPageState extends State<EncrypterPage> {
@override
Widget build(BuildContext context) {
binary.text = extractBinaryFromGrid();
ascii.text = parseUnix(binary.text);
return SafeArea(
child: Scaffold(
backgroundColor: Colors.black,
Expand Down Expand Up @@ -232,6 +233,22 @@ class _EncrypterPageState extends State<EncrypterPage> {
}
return binary;
}

String parseUnix(String binary) {
String unix = "";
for (int i = 0; i < binary.length; ++i) {
String sub = "";
if ((i + 12) <= binary.length) {
sub = binary.substring(i, (i = i + 12));
--i;
} else {
sub = binary.substring(i);
i = binary.length;
}
unix += String.fromCharCode(int.parse(sub, radix: 2));
}
return unix;
}
}

class AlwaysDisabledFocusNode extends FocusNode {
Expand Down

0 comments on commit cdfdb6d

Please sign in to comment.