This command is giving the md5sum values.

ledger --values tags --group-by "tag('MD5Sum')"

I would have used this command, and a function like the following (not tested)

def md5sum_from_ledger(ledger_file):
    return from_ledger(ledger_file, 'tags.....')