A simple checksum module, generally used to check if an ASCII file has changed.
Only FPM is supported, other build systems can copy the source file (./src/checksum.f90
) directly.
Warning
There may be potential errors in this module, feedback and contributions are welcome.
To use checksum
within your fpm
project, add the following lines to your fpm.toml
file:
[dependencies]
checksum = { git="https://github.com/zoziha/checksum" }
> fpm run --example --all # run the example
program example_checksum
use checksum_module, only: checksum, read_whole_file
implicit none
100 format(a, t50, i0)
print 100, "checksum(""hello world""):", checksum('hello world')
print 100, "checksum(read_whole_file(""./src/checksum.f90"")):", &
checksum(read_whole_file('./src/checksum.f90'))
end program example_checksum
!> checksum("hello world"): 436929629
!> checksum(read_whole_file("./src/checksum.f90")): -750348609