Last active
October 30, 2017 23:14
-
-
Save cedriczirtacic/d90fc776d30b40a186ad45e0e9e243c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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