mirror of
https://github.com/noDRM/DeDRM_tools.git
synced 2026-03-20 04:58:56 +00:00
Fix python2 issues in kgenpids and kindlekey
This commit is contained in:
@@ -115,11 +115,17 @@ def primes(n):
|
||||
def encode(data, map):
|
||||
result = b''
|
||||
for char in data:
|
||||
value = char
|
||||
if sys.version_info[0] == 2:
|
||||
value = ord(char)
|
||||
else:
|
||||
value = char
|
||||
|
||||
Q = (value ^ 0x80) // len(map)
|
||||
R = value % len(map)
|
||||
result += bytes([map[Q]])
|
||||
result += bytes([map[R]])
|
||||
|
||||
result += bytes(bytearray([map[Q]]))
|
||||
result += bytes(bytearray([map[R]]))
|
||||
|
||||
return result
|
||||
|
||||
# Hash the bytes in data and then encode the digest with the characters in map
|
||||
|
||||
Reference in New Issue
Block a user