This is a reply to a message to this list, that was posted 9 years ago. Well, it's never too late, is it? :-)

While trying to find how the md5 in the Bacula database is encoded, all I found was this message by Rory Campbell-Lange who had the same question and only a part of the answer : https://sourceforge.net/p/bacula/mailman/message/25948484/

It turns out it's easy to convert between the usual md5 format and the base64 encoded version used in Bacula, so here is a short Perl script which does that conversion:

#!/usr/bin/perl

## Convert md5 checksums between the formats used by
## - standard md5sum utilities (eg. "d41d8cd98f00b204e9800998ecf8427e")
## - and the base64 encoded version used by Bacula (eg. 
"1B2M2Y8AsgTpgAmY7PhCfg")

my $VERSION = 0.1;

use strict;
use MIME::Base64;

$_ = shift;

unless ($_) {
        die "Usage: $0 md5_to_convert\n";
}

if ( /^[0-9a-f]{32}$/ ) {
        $_ = encode_base64(pack("H*", $_));
        s/=*$//;
        print;
}
elsif ( /^[0-9a-zA-Z\/+]{22}$/ ) {
        print unpack("H*", decode_base64($_)), "\n";
}
else {
        die "Doesn't look like an md5: '$_'\n";
}


[Bacula-users] Catalog MD5 not matching file MD5
From: Rory Campbell-Lange <rory@ca...> - 2010-08-14 11:15:59

Sorry to be asking so many questions, again.

I have the following catalog record for a file:

    path: /backup/archive/datasnap0/etc/
    file: wgetrc
    md5 : 7rJlwjvesDfThOLanMuCog

After restoring this file I have run md5, and I get:

    eeb265c23bdeb037d384e2da9ccb82a2  wgetrc

After reading the docs I understand that the catalog record is a base64
encoding. However, running

    openssl dgst -md5 archive/datasnap0/etc/wgetrc | awk '{print $2}' | openssl enc -base64

returns ZWViMjY1YzIzYmRlYjAzN2QzODRlMmRhOWNjYjgyYTIK

How can I match the catalog md5 record to the restored file's md5?

--
Rory Campbell-Lange
rory@...




_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to