Sign inSign up

y0mg/hasher

By y0mg

Updated about 2 years ago

This utility handles various cryptographic functions and file hashing tasks.

Image
Security
Developer tools
0

1.2K

y0mg/hasher repository overview

Run by entering: docker run -it hasher

This container is a utility for handling various cryptographic functions and file hashing tasks. Here’s a breakdown of its functionalities:

  1. Password Hashing with bcrypt Function hash_password(password): Takes a plaintext password and generates a bcrypt hash. Function check_password(hashed, password): Verifies a given plaintext password against a bcrypt hash to check if they match.

  2. File Hashing Function generate_md5(file_path): Computes the MD5 hash of a file. It reads the file in binary mode and processes it in chunks to calculate the hash. Function generate_sha256(file_path): Computes the SHA-256 hash of a file in a similar manner to MD5.

  3. HMAC Generation Function generate_hmac(key, message): Generates an HMAC (Hash-based Message Authentication Code) using a provided key and message, utilizing SHA-256 as the hash function.

  4. SSL Key Generation Function create_ssl_keys(output_dir="."): Generates a self-signed SSL certificate and private key. Inputs: Prompts the user for various details like country, state, locality, organization, common name, certificate validity, and DNS names. Outputs: Saves the private key (private_key.pem) and certificate (certificate.pem) in the specified output directory. If no directory is provided, it defaults to the current directory. Error Handling: Catches exceptions and prints an error message if something goes wrong during key generation.

  5. User Interaction Function main(): Provides a command-line interface for the user to choose from the following options:

  1. Generate a bcrypt hash.
  2. Create SSL keys.
  3. Generate MD5 hash of a file.
  4. Generate SHA-256 hash of a file.
  5. Generate HMAC.

Based on the user’s choice, it invokes the respective function and handles inputs/outputs accordingly. It also includes error handling for file operations in the MD5 and SHA-256 hash generation. Additional Details Defaults and Prompts: For SSL key generation, default values are provided if the user does not input any specific details.

Error Handling: Includes checks for file validity and exception handling to ensure smooth execution and user feedback. Overall, the program is designed to handle common cryptographic tasks, file hashing, and SSL key creation, making it a versatile tool for security and data integrity needs.

Tag summary

Content type

Image

Digest

sha256:10f0aa487

Size

52.6 MB

Last updated

about 2 years ago

docker pull y0mg/hasher