This information is also available in the FortiOS 7.0 Administration Guide:
This command computes the SHA256 file hashes for all of the files in a directory or directories:
# diagnose sys filesystem hash <paths> -d [depth]
Add up to 25 paths to show only the hash for the files at those paths.
Specify the maximum depth of the traversal.
This command can be used for troubleshooting and debugging the system. The file hashes of system files can be compared against known good system files to help identify any compromises made on the system files.
For more information about this feature, see Command to compute file hashes.