Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'digest'
- mySha1 = Digest::SHA1.new
- if (ARGV.index('-h')) && (ARGV[ARGV.index('-h')+1] != nil) # check if '-h' switch is in ARGV[] and the following index is non-null.
- myFile = ARGV[ARGV.index('-h')+1]
- if File.exist?(myFile) # next check if that file exists.
- File.open(myFile]) do|file|
- myBuff = ''
- while not file.eof
- file.read(512, myBuff)
- mySha1.update(myBuff)
- end
- print mySha1
- end
- else
- print 'Invalid file specified'
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment