moved to StringUtils

git-svn-id: file:///home/svn/incoming/trunk@2607 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Spoon M 2005-06-09 16:49:11 +00:00
parent a7dc32cb50
commit 60f9c96b3f
1 changed files with 3 additions and 13 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/ruby
require 'Rex/Encoding/Xor/Exceptions'
require 'Rex/StringUtils'
module Rex
module Encoding
@ -15,17 +16,6 @@ class Generic
return 0
end
#
# return nil if no badchars in data, otherwise return the position of
# the first bad character
#
def Generic.badchar_index(data, badchars)
badchars.each_byte { |badchar|
pos = data.index(badchar)
return pos if pos
}
return nil
end
#
# Now for some internal check methods
#
@ -36,10 +26,10 @@ class Generic
return _check_key(key, badchars) || _check_encode(data, key, badchars)
end
def Generic._check_key(key, badchars)
return badchar_index(key, badchars)
return Rex::StringUtils.badchar_index(key, badchars)
end
def Generic._check_encode(data, key, badchars)
return badchar_index(encode(data, key), badchars)
return Rex::StringUtils.badchar_index(encode(data, key), badchars)
end
def Generic.find_key(data, badchars)