Skip to content

Instantly share code, notes, and snippets.

@claudijd
Created July 3, 2013 14:22
Show Gist options
  • Save claudijd/5918314 to your computer and use it in GitHub Desktop.
Save claudijd/5918314 to your computer and use it in GitHub Desktop.
Openswan VID Generation tool
#!/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