Skip to content

Commit da54f79

Browse files
authored
Add files via upload
1 parent ae44785 commit da54f79

14 files changed

+1401
-0
lines changed

main.py

Lines changed: 849 additions & 0 deletions
Large diffs are not rendered by default.

mc3ds-model-editor.7z

21.3 KB
Binary file not shown.

modules/JOAAThash.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import sys
2+
# From stack overflow (https://stackoverflow.com/questions/70177888/jenkins-one-at-a-time-hash-trying-to-make-python-code-reproduce-javascript-cod)
3+
def calculateChecksum(keyString: str):
4+
# Credits(modified code): Bob Jenkins (http://www.burtleburtle.net/bob/hash/doobs.html)
5+
# See also: https://en.wikipedia.org/wiki/Jenkins_hash_function
6+
# Takes a string of any size and returns an avalanching hash string of 8 hex characters.
7+
hash = 0
8+
# for (charIndex = 0; charIndex < keyString.length; ++charIndex):
9+
for char in keyString:
10+
hash += ord(char.encode("utf-8"))
11+
hash &= 0xFFFFFFFF
12+
hash += hash << 10
13+
hash &= 0xFFFFFFFF
14+
hash ^= hash >> 6
15+
hash &= 0xFFFFFFFF
16+
hash += hash << 3
17+
hash &= 0xFFFFFFFF
18+
hash ^= hash >> 11
19+
hash &= 0xFFFFFFFF
20+
hash += hash << 15
21+
hash &= 0xFFFFFFFF
22+
# # 4,294,967,295 is 0xffffffff, the maximum 32 bit unsigned integer value, used here as a mask.
23+
return hex((hash & 4294967295))
24+
25+
# This is mine :)
26+
def getLittleJOAAThash(text: str):
27+
hash = calculateChecksum(text)
28+
if len(hash[2:]) % 2 != 0:
29+
hex_value = '0' + hash[2:]
30+
else:
31+
hex_value = hash[2:]
32+
little_version = bytes.fromhex(hex_value)[::-1]
33+
if len(little_version) < 4:
34+
little_version = little_version + b'\0'
35+
return little_version

modules/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .bjson import *
1.32 KB
Binary file not shown.
194 Bytes
Binary file not shown.
23.4 KB
Binary file not shown.
2.34 KB
Binary file not shown.
2.17 KB
Binary file not shown.

modules/bjson.py

Lines changed: 432 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)