https://github.com/oanderoficial/criptografando-arquivos
Criptografando arquivos com Python. Utilizando o módulo hashlib.
https://github.com/oanderoficial/criptografando-arquivos
criptography linux python script
Last synced: about 1 month ago
JSON representation
Criptografando arquivos com Python. Utilizando o módulo hashlib.
- Host: GitHub
- URL: https://github.com/oanderoficial/criptografando-arquivos
- Owner: oanderoficial
- Created: 2021-09-18T13:27:27.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-22T22:25:28.000Z (over 1 year ago)
- Last Synced: 2025-03-26T15:18:02.250Z (7 months ago)
- Topics: criptography, linux, python, script
- Language: Python
- Homepage:
- Size: 250 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Criptografando-arquivos
Criptografando arquivos com Python. Utilizando o módulo hashlib.# code
```python
import hashlib
import osdir_path = "/home/ander/Documentos/tools/"
for file_name in os.listdir(dir_path):
file_path = os.path.join(dir_path, file_name)with open(file_path, 'rb') as file:
file_data = file.read()
encrypted_data = hashlib.sha512(file_data).hexdigest().encode()new_file_name = "(criptografado) " + file_name
new_file_path = os.path.join(dir_path, new_file_name)with open(new_file_path, 'wb') as new_file:
new_file.write(encrypted_data)os.remove(file_path)
```