Skip to content

Commit

Permalink
Added missing documentation and YARD tags to Crypto methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Aug 20, 2024
1 parent 59e1158 commit c4aefbd
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ronin/support/crypto/core_ext/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,9 @@ def self.aes256_decrypt(path, block_size: 16384, output: nil, **kwargs,&block)
#
# Encrypts the file using the given RSA key.
#
# @param [String] path
# The path to the file.
#
# @param [Hash{Symbol => Object}] kwargs
# Additional keyword arguments for {Ronin::Support::Crypto.rsa_encrypt}.
#
Expand Down Expand Up @@ -661,6 +664,9 @@ def self.rsa_encrypt(path,**kwargs)
#
# Decrypts the file using the given RSA key.
#
# @param [String] path
# The path to the file.
#
# @param [Hash{Symbol => Object}] kwargs
# Additional keyword arguments for {Ronin::Support::Crypto.rsa_decrypt}.
#
Expand Down
8 changes: 8 additions & 0 deletions lib/ronin/support/crypto/core_ext/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

class String

#
# Calculates the MD5 checksum of the String.
#
# @return [String]
# The MD5 checksum of the String.
Expand All @@ -36,6 +38,8 @@ def md5
Digest::MD5.hexdigest(self)
end

#
# Calculates the SHA1 checksum of the String.
#
# @return [String]
# The SHA1 checksum of the String.
Expand All @@ -52,6 +56,8 @@ def sha1

alias sha128 sha1

#
# Calculates the SHA256 checksum of the String.
#
# @return [String]
# The SHA256 checksum of the String.
Expand All @@ -68,6 +74,8 @@ def sha256

alias sha2 sha256

#
# Calculates the SHA512 checksum of the String.
#
# @return [String]
# The SHA512 checksum of the String.
Expand Down
30 changes: 30 additions & 0 deletions lib/ronin/support/crypto/mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ def crypto_cipher(name,**kwargs)
# @param [Hash{Symbol => Object}] kwargs
# Additional keyword arguments for {cipher}.
#
# @option kwargs [Symbol] :hash (:sha256)
# The algorithm to hash the `:password`.
#
# @option kwargs [String] :key
# The secret key to use.
#
# @option kwargs [String] :password
# The password for the cipher.
#
# @option kwargs [String] :iv
# The optional Initial Vector (IV).
#
# @option kwargs [Integer] :padding
# Sets the padding for the cipher.
#
# @return [String]
# The encrypted data.
#
Expand All @@ -161,6 +176,21 @@ def crypto_encrypt(data, cipher: ,**kwargs)
# @param [Hash{Symbol => Object}] kwargs
# Additional keyword arguments for {cipher}.
#
# @option kwargs [Symbol] :hash (:sha256)
# The algorithm to hash the `:password`.
#
# @option kwargs [String] :key
# The secret key to use.
#
# @option kwargs [String] :password
# The password for the cipher.
#
# @option kwargs [String] :iv
# The optional Initial Vector (IV).
#
# @option kwargs [Integer] :padding
# Sets the padding for the cipher.
#
# @return [String]
# The decrypted data.
#
Expand Down

0 comments on commit c4aefbd

Please sign in to comment.