1

Here is the command I use (on a windows box):

$ FCIV -md5 C:\Files -xml C:\data\config.xml -r

It creates the xml as expected but the md5 checksums seem to be wrong. If I run the following command:

$ FCIV -md5 file.txt

I get what I believe to be the correct checksum (matches what linux box gives me). Either way I don't understand why outputting to config.xml would have a different checksum of the file.

If I output the second command to xml the md5 checksum seems to be wrong (same sum as the first command).

Is there a parameter I need that I can't find (I've googled, man page..)? Or am I misunderstanding how something works here? As always, appreciate the help! :)

Brayden Hancock
  • 786
  • 1
  • 6
  • 22
  • I found some information that helps but I still don't understand it: "The hash is stored in base 64". Using an online decoder this doesn't produce the correct hash. I went to http://ostermiller.org/calc/encode.html, put in eC5CUs5fbOF+3xljArN5iA==, expected 782e4252ce5f6ce17edf196302b37988 but got x.BRÎ_lá~ßc³y (base 64 decode). – Brayden Hancock Dec 16 '14 at 06:11

2 Answers2

2

I recently had to do some conversions in this manner myself, and used python (2.7) to get it done. Code below in case it helps anyone:

import binascii

#convert checksum printed in fciv command line output to format stored in xml file
def hashToXml(checksum):
    #the trailing index notation is to trim the trailing /n added by b2a_base64
    return binascii.b2a_base64(binascii.unhexlify(checksum))[:-1]

#convert format stored in xml to checksum printed in fciv command line output
def xmlToHash(xmlstring):
    return binascii.hexlify(binascii.a2b_base64(xmlstring))

Example:

>>> hashToXml('8ca5d7447bfe25ce9f29bb70e1fcaf59')
'jKXXRHv+Jc6fKbtw4fyvWQ=='

>>> xmlToHash('jKXXRHv+Jc6fKbtw4fyvWQ==')
'8ca5d7447bfe25ce9f29bb70e1fcaf59'
1

So the problem was that FCIV encoded the hash in Base 64 when saving to xml. Here is the link that answered my question: http://hansbobby.logdown.com/posts/200764-decode-base64-binary-sha1-hash

Basically used the command: echo 'FCC9sNSHaSfhqpYS3JwEgKzeL3I=' | openssl enc -base64 -d | xxd -p. Had to yum install vim-common.

The following link was also helpful, explaining the problem: https://social.technet.microsoft.com/Forums/windowsserver/en-US/a828e6a5-c142-4b9a-8936-260a9da4a9c4/sha1-hashes-and-base64-encoding-wierdness

Brayden Hancock
  • 786
  • 1
  • 6
  • 22