Skip to content

Instantly share code, notes, and snippets.

Created Sep 6, 2011

What would you like to do?
my $id = 'ZywYdtlIl8amEGe-Rq8xTg';
use MIME::Base64;
$id =~ tr{_-}{+/};
$id .= 'AA';
my $bin_id = decode_base64($id);
my $hex_id = unpack("H*", $bin_id);
$hex_id =~ s/0{3,4}$//;
# print $hex_id
my @parts = ($hex_id =~ m/^((.{2})(.{2}).+)/)[1,2,0];
print map "$_\n", join '/', @parts;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.