Verifying the files you have stored on our servers is an important part of data integrity. To calculate the MD5 we store on our servers in Perl the quick solution would be to use the built in b64digest output which is part of the Digest::MD5 class.
For the test file the MD5 being returned by Nirvanix ListFolder is: bNIkeoRicdpTMoPyuN/4rg==
use Digest::MD5;
use MIME::Base64;
my $file = shift || "./somefile.txt";
open(FILE, $file) or die "Can't open '$file': $!";
binmode(FILE);
print Digest::MD5->new->addfile(*FILE)->b64digest, " $file\n";
output:
bNIkeoRicdpTMoPyuN/4rg ./somefile.txt
For some reason this does not produce the expecting padding of: ==
If you change the script slightly to call the base 64 encoding externally using the digest output (binary MD5) then it will report the correct value.
use Digest::MD5;
use MIME::Base64;
my $file = shift || "./somefile.txt";
open(FILE, $file) or die "Can't open '$file': $!";
binmode(FILE);
print encode_base64(Digest::MD5->new->addfile(*FILE)->digest), " $file\n";
output:
bNIkeoRicdpTMoPyuN/4rg==
./somefile.txt
It is important that you do not just add == to the results of the b64digest since this is not always returned (though usually is). There are cases when the extra bytes are used by the base64 algorithm.