Skip to content

Instantly share code, notes, and snippets.

@cedriczirtacic
Last active October 30, 2017 23:14
Show Gist options
  • Save cedriczirtacic/d90fc776d30b40a186ad45e0e9e243c4 to your computer and use it in GitHub Desktop.
Save cedriczirtacic/d90fc776d30b40a186ad45e0e9e243c4 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
use strict;
use warnings;
use Digest::MD5 qw( md5_hex );
sub generate_serial($) {
my $name = shift || return undef;
my $md5 = md5_hex($name . "+unicorn");
$md5 =~ tr/a-f/A-F/;
$md5 = substr($md5, 0, 20);
return($md5);
}
if ($#ARGV < 0) {
printf("%s <name>\n", $0);
exit 1;
}
print "Serial: ", generate_serial($ARGV[0]), $/;
exit 0;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment