Skip to content

Instantly share code, notes, and snippets.

@yuta-aoyagi
Created September 24, 2012 09:32
Show Gist options
  • Save yuta-aoyagi/3775123 to your computer and use it in GitHub Desktop.
Save yuta-aoyagi/3775123 to your computer and use it in GitHub Desktop.
Calculate SHA1 hash of text file for each lines
require 'digest/sha1'
open(ARGV[0], "r") do |f|
f.each_line do |s|
print Digest::SHA1.hexdigest(s), " ", s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment