There was an error while loading. Please reload this page.
1 parent e802b0d commit 87f2c3fCopy full SHA for 87f2c3f
xortool/xortool-xor
@@ -23,9 +23,6 @@ import string
23
import sys
24
25
26
-HEXES = set("0123456789abcdefABCDEF")
27
-
28
29
def main():
30
cycle = True
31
newline = True
@@ -71,20 +68,10 @@ def xor(args, cycle=True):
71
68
72
69
73
70
def from_str(s):
74
- res = []
75
- i = 0
76
- while True:
77
- if i + 4 > len(s):
78
- break
79
80
- if s[i] == "\\" and s[i+1] == "x" and s[i+2] in HEXES and s[i+3] in HEXES:
81
- res.append(int(s[i+2:i+4], 16))
82
- i += 4
83
- else:
84
- res.append(ord(s[i]))
85
- i += 1
86
- res += s[i:].encode("ascii")
87
- return bytes(res)
+ res = b''
+ for char in s.encode("utf-8").decode("unicode_escape"):
+ res += bytes([ord(char)])
+ return res
88
89
90
def from_file(s):
0 commit comments