diff --git a/lib/rex/text.rb b/lib/rex/text.rb index 1ce4943202..bccc7c9f96 100644 --- a/lib/rex/text.rb +++ b/lib/rex/text.rb @@ -1,5 +1,6 @@ # -*- coding: binary -*- require 'digest/md5' +require 'digest/sha1' require 'stringio' begin @@ -812,6 +813,20 @@ module Text Digest::MD5.hexdigest(str) end + # + # Raw SHA1 digest of the supplied string + # + def self.sha1_raw(str) + Digest::SHA1.digest(str) + end + + # + # Hexidecimal SHA1 digest of the supplied string + # + def self.sha1(str) + Digest::SHA1.hexdigest(str) + end + # # Convert hex-encoded characters to literals. # Example: "AA\\x42CC" becomes "AABCC"