Permalink
Browse files

Added sha256 hashing applet

  • Loading branch information...
1 parent 1c09929 commit c48611b89587fb3d50f51afd5d50ba92fc4deec7 @dbrady committed Mar 25, 2009
Showing with 17 additions and 0 deletions.
  1. +17 −0 sha256
View
17 sha256
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+# sha - dump a SHA hash of given text/files.
+#
+# Usage:
+# sha <file> [<file>]
+# echo "foo" | sha
+
+require 'digest/md5'
+
+digest = Digest::SHA2.new
+ARGF.each do |file_contents|
+ file_contents.each_line do |line|
+ digest << line
+ end
+end
+
+puts digest.hexdigest

0 comments on commit c48611b

Please sign in to comment.