12345678910111213141516171819202122 |
- def xor_encrypt_decrypt(input_file, output_file, key):
- with open(input_file, 'rb') as f:
- data = f.read()
-
-
- encrypted_data = bytes([byte ^ key for byte in data])
-
-
- with open(output_file, 'wb') as f:
- f.write(encrypted_data)
- input_file = 'index2.html'
- output_file = 'index3.html'
- key = 0x12
- xor_encrypt_decrypt(input_file, output_file, key)
- print("文件已加密/解密并保存到", output_file)
|