Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save picatz/1e6e986118185ec207309ec9bde6980a to your computer and use it in GitHub Desktop.
Save picatz/1e6e986118185ec207309ec9bde6980a to your computer and use it in GitHub Desktop.
Violent Ruby: Unix Password Cracker Format Results
private
# @api private
# Format the results for the password crack'n.
#
# @param user [String]
# @param encrypted_pass [String]
# @param plaintext_pass [String]
#
# @return [Hash]
def format_result(user, encrypted_pass, plaintext_pass = false)
result = {}
if plaintext_pass
result[:cracked] = true
else
result[:cracked] = false
end
result[:username] = user
result[:encrypted_password] = encrypted_pass
result[:plaintext_password] = plaintext_pass if plaintext_pass
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment