Ruby provides a build-in module called digest to calculate the checksum for a file. The digest module does not require any extra installation.
Include the digest module using the following code sample:
Code Sample to Calculate Checksum
checksum = Digest::SHA2.hexdigest( File.read("Path of the file") );
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.