Skip to content

Instantly share code, notes, and snippets.

@selftaught

selftaught/raddr Secret

Created December 21, 2017 12:54
Show Gist options
  • Save selftaught/5ba8e942f68ae38719243de8d07bcaea to your computer and use it in GitHub Desktop.
Save selftaught/5ba8e942f68ae38719243de8d07bcaea to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Getopt::Long;
my $address;
GetOptions('a|address=s' => \$address);
if ($address) {
my $len;
my @bytes = split('', $address);
if (($len = length $address) == 10 &&
$bytes[0] eq '0' && lc $bytes[1] eq 'x') {
$address = substr $address, 2, $len;
}
say '\x' . join ('\x', reverse ($address =~ m/../g));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment