aboutsummaryrefslogtreecommitdiff
path: root/block2hex.pl
diff options
context:
space:
mode:
Diffstat (limited to 'block2hex.pl')
-rw-r--r--block2hex.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/block2hex.pl b/block2hex.pl
new file mode 100644
index 0000000..c1e44f0
--- /dev/null
+++ b/block2hex.pl
@@ -0,0 +1,13 @@
+#!/usr/bin/perl -w
+
+while(<>) {
+ chomp;
+ #$was = $_;
+ s/$/ / while length($_) < 8;
+ s/X/1/g;
+ s/ /0/g;
+ #warn "was '$was', now '$_'\n";
+ push @out, sprintf("0x%02x", eval "0b$_");
+}
+
+print join(", ", @out) . "\n";