To view the MD5 hash of a text file, follow these steps based on your operating system:
1. Using Command-Line Tools
- Linux/macOS:
- Open a terminal.
- Run the command: md5sum filename.txt
-
The output will display the MD5 hash and the filename.
-
Windows:
- Open Command Prompt.
- Navigate to the file’s directory using cd.
- Run the command: certutil –hashfile filename.txt MD5
2. Using Online Tools
- Visit a website like md5online.com.
- Upload your text file and click “Calculate Hash.”
3. Writing a Python Script
1 2 3 4 5 6 7 8 9 |
import hashlib def compute_md5(file_path): with open(file_path, ‘rb’) as f: file_content = f.read() return hashlib.md5(file_content).hexdigest() print(compute_md5(‘filename.txt’)) |
Each method provides the MD5 hash efficiently, ensuring the integrity of your text file.