Created
July 3, 2013 14:22
-
-
Save claudijd/5918314 to your computer and use it in GitHub Desktop.
Openswan VID Generation tool
This file contains 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 | |
use warnings; | |
use strict; | |
use Digest::MD5 qw(md5); | |
# | |
my $openssl_version = shift(); | |
die "Usage: openswan-vid <OpenSwan_version_string>\n" unless defined $openssl_version; | |
# | |
my $md5_hash = md5($openssl_version); | |
my @values = unpack("C10", $md5_hash); | |
my $value; | |
# | |
print "4f45"; # Hex representation of "OE" | |
foreach (@values) { | |
$value = $_ & 0x7f | 0x40; # Set bit-7 and clear bit-6 | |
printf("%x", $value); | |
} | |
print "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment