-
-
Save coderxin/59a986a900532fd07e0cc93be0f4880e to your computer and use it in GitHub Desktop.
Ruby: create checksum on hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thanks to tenderlove on Peepcode play by play | |
require 'digest/md5' | |
def fetch username | |
records = JSON.parse get username | |
records.each do |hash| | |
checksum = Digest::MD5.hexdigest Marshal.dump(hash) | |
hash['checksum'] = checksum | |
end | |
records | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment