Sha256: f35fa60d5981f972cef3f6e1ebc011b48a5bc4f4c5c54099aba103c5c9028012

Contents?: true

Size: 311 Bytes

Versions: 1

Compression:

Stored size: 311 Bytes

Contents

# Computes the SHA1 hash of any file (passed
# on the command line)

require 'digest'

sha1 = Digest::SHA1.new

File.open(ARGV[0]) do|file|
  buffer = ''

  # Read the file 512 bytes at a time
  while not file.eof
    file.read(512, buffer)
    sha1.update(buffer)
  end
end

puts sha1  # Implicitly calls to_s

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
junior-rails-0.0.1 sha1_version_generator.rb