Calculating Checksum

Calculating Checksum

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:

require 'digest'

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.