Add Rex::Text.sha1 and Rex::Text.sha1_raw

This commit is contained in:
HD Moore 2012-10-28 23:49:21 -05:00
parent 19920b3275
commit 6ec392c4cf
1 changed files with 15 additions and 0 deletions

View File

@ -1,5 +1,6 @@
# -*- coding: binary -*- # -*- coding: binary -*-
require 'digest/md5' require 'digest/md5'
require 'digest/sha1'
require 'stringio' require 'stringio'
begin begin
@ -812,6 +813,20 @@ module Text
Digest::MD5.hexdigest(str) Digest::MD5.hexdigest(str)
end 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. # Convert hex-encoded characters to literals.
# Example: "AA\\x42CC" becomes "AABCC" # Example: "AA\\x42CC" becomes "AABCC"