Output text.txt to text.encode.txt.
With Python
encode.py
# coding:UTF-8
#Read stream
with open("text.txt","r") as origin_file:
stream_raw = origin_file.read()
# ord()Get code value with
str_code_num = (ord(str) for str in stream_raw)
#Code value from 0 to 255
seed = 255
#Connect while xor
enc_result = "".join(map(lambda str: chr(str^seed), str_code_num))
#Export to file
with open('text.encode.txt', 'w') as new_file:
new_file.write(enc_result)
Recommended Posts