lib/ronin/password.rb in ronin-1.0.0 vs lib/ronin/password.rb in ronin-1.1.0.rc1

- old
+ new

@@ -16,16 +16,15 @@ # You should have received a copy of the GNU General Public License # along with Ronin. If not, see <http://www.gnu.org/licenses/>. # require 'ronin/model' +require 'ronin/credential' require 'digest' module Ronin - autoload :Credential, 'ronin/credential' - # # Represents a password that can be stored in the {Database}. # class Password @@ -33,11 +32,12 @@ # Primary key of the password property :id, Serial # The clear-text of the password - property :clear_text, String, :required => true, + property :clear_text, String, :length => 256, + :required => true, :unique => true # The credentials which use the password has 0..n, :credentials @@ -77,10 +77,12 @@ # pass.digest(:sha1, :append_salt => "BBBB") # # => "aa6ca21e446d425fc044bbb26e950a788444a5b8" # # @since 1.0.0 # + # @api public + # def digest(algorithm,options={}) digest_class = begin Digest.const_get(algorithm.to_s.upcase) rescue LoadError raise(ArgumentError,"Unknown Digest algorithm #{algorithm}") @@ -107,10 +109,12 @@ # @return [Integer] # The number of credentials that use the password. # # @since 1.0.0 # + # @api public + # def count self.credentials.count end # @@ -119,10 +123,12 @@ # @return [String] # The clear-text of the password. # # @since 1.0.0 # + # @api public + # def to_s self.clear_text end # @@ -130,9 +136,11 @@ # # @return [String] # The inspected password. # # @since 1.0.0 + # + # @api public # def inspect "#<#{self.class}: #{self.clear_text}>" end