Für MD4 Hash benötigen Sie Crypto-Modul @DRPK.
pip install Crypto
Oder laden Sie es von:
können Sie dieses Paket von pip Befehl wie folgt installieren
https://pypi.python.org/pypi/pycrypto
Lets für Hauptcode gehen:
from Crypto.Hash import MD4
your_file_path = "your_target_file" # change this item with your own address ...
your_result_path = "your_result_file" # change this item with your own address ...
def md4_of_each_words(your_file_path):
md4_hash = MD4.new()
with open(your_file_path, "r") as raw_data:
read_raw_data = raw_data.read()
make_a_list = read_raw_data.split('\n')
for lines in make_a_list:
if not lines.replace(" ", '').replace("\t", "") == "":
words_list = lines.split(' ')
for words in words_list:
if not words.replace(" ", "").replace("\t", "") == "":
# Calculate MD4 Hash For Each Valid Words
md4_hash.update(words)
last_md4 = md4_hash.hexdigest() + "\n"
with open(your_result_path, "a") as md4_list:
md4_list.write(words + last_md4)
else:
pass
else:
pass
return "Completed."
md4_of_each_words(your_file_path)
Good Luck
können Sie ein Beispiel für list.txt angeben, wie definieren Sie ein Wort und welche Art von Ausgabe möchten Sie (wie alle Wörter in einer Zeile, jedes Wort in der neuen Zeile)? – ands