Skip to content

Commit

Permalink
0.95
Browse files Browse the repository at this point in the history
  • Loading branch information
ADHSoft committed Apr 8, 2024
1 parent 0f28e7f commit fa126ae
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 185 deletions.
13 changes: 13 additions & 0 deletions bcolors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'

ERR = FAIL
WARN = WARNING
END = ENDC
23 changes: 11 additions & 12 deletions functions.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from typing import List

import numba
import xipDecoder_strategy

def checksumA(a, b, c) -> bool:
def checksumA(a:int , b:int, c:int) -> bool:
if c == 0:
#if __debug__: print("Unimplemented border case") TODO?
b ^= 1
var1 = a * b
var1 &= 0xFF
var1 = (a * b) & 0xFF
return var1 == c

def japDeXor(input_: bytes, offset: int , strategy: xipDecoder_strategy.XipDecoderStrategy ) -> bytes:
Expand All @@ -16,7 +17,7 @@ def japDeXor(input_: bytes, offset: int , strategy: xipDecoder_strategy.XipDecod

output = bytes()
for i in range( strategy.fileHeaderLength()):
offset %= len(xorKey)
offset &= 255 #len(xorKey)
byteA = (xorKey[offset] ^ input_[i]).to_bytes(1, "big")
output += bytearray(byteA)
offset += 1
Expand All @@ -40,16 +41,14 @@ def deXorTxt(input_: bytes) -> bytes:
if i > 0:
output += input_[-i:]

return output
return output

def deXorVisualClip(input_: bytes) -> bytes:
from xipDecoder_strategy import Crc32Table
key : List[int] = [Crc32Table()[i] for i in range(Crc32Table.size)]
key : bytes = xipDecoder_strategy.VcKey().get()
offset = 0xED
output = input_[0:8] # preserve the first 8 bytes.
for i in range(8, len(input_) ):
offset %= len(key)
byteA = ((key[(offset) % 0x100] ^ input_[i]) & 0xFF).to_bytes(1, "big")
output += bytearray(byteA)
output = bytearray(input_[:])
for i in range(8, len(input_) ):# preserve the first 8 bytes.
offset &= 255 #len(key)
output[i] = key[offset % 256] ^ input_[i]
offset += 1
return output
2 changes: 1 addition & 1 deletion keyFiles/disclaimer.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
txtKey is just a crc32 table in the wrong order.
txtKey is like a crc32 table
Loading

0 comments on commit fa126ae

Please sign in to comment.