fciv.py – Python Module for Microsoft FCIV
fciv.py is a Python module that I implemented to generate file integrity data in a format used by Microsoft File Checksum Integrity Verifier. My use case involves copying files from a Linux workstation to a Microsoft Windows workstation. I wanted to generate integrity data on Linux using Python 3 and verify file integrity on Microsoft Windows without installing 3rd party software.
FCIV file content is generated with the following Python snippet:
import fciv
digests = fciv.fciv_compute('mydirectory/**')
fciv.fciv_write(digests)
With the output of the generation script redirected to a file named ‘fciv.xml’, the following snippet performs verification:
import fciv
reference_digests = fciv.fciv_read('fciv.xml')
actual_digests = fciv.fciv_compute('mydirectory/**')
fciv.fciv_verify(actual_digests, reference_digests)
The verification performed by fciv.py reports mismatches between expected and actual file checksums. Files missing from and files in addition to that of the verification data are also reported.