Browse Source

modify comments

pull/7/head
Nzix 6 years ago
parent
commit
0892d55d92
  1. 4
      ncmdump.py

4
ncmdump.py

@ -38,7 +38,7 @@ def dump(input_path, output_path = None):
key_data = unpad(cryptor.decrypt(key_data))[17:] key_data = unpad(cryptor.decrypt(key_data))[17:]
key_length = len(key_data) key_length = len(key_data)
# key box (standard RC4 Key-scheduling algorithm) # S-box (standard RC4 Key-scheduling algorithm)
key = bytearray(key_data) key = bytearray(key_data)
S = bytearray(range(256)) S = bytearray(range(256))
j = 0 j = 0
@ -80,7 +80,7 @@ def dump(input_path, output_path = None):
for k, _ in enumerate(data): for k, _ in enumerate(data):
i = (i + 1) % 256 i = (i + 1) % 256
j = (i + S[i]) % 256 # in RC4, is j = (j + S[i]) % 256 j = (i + S[i]) % 256 # in RC4, is j = (j + S[i]) % 256
# S[i], S[j] = S[j], S[i] # skip swapping # S[i], S[j] = S[j], S[i] # no swapping
data[k] ^= S[(S[i] + S[j]) % 256] data[k] ^= S[(S[i] + S[j]) % 256]
m.write(data) m.write(data)

Loading…
Cancel
Save