Skip to content

Instantly share code, notes, and snippets.

@andrewbroman
Created July 12, 2012 16:16
Show Gist options
  • Save andrewbroman/3099117 to your computer and use it in GitHub Desktop.
Save andrewbroman/3099117 to your computer and use it in GitHub Desktop.
Ruby: create checksum on hash
# 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