Created
February 20, 2025 11:43
-
-
Save dot-mike/e6d380bd67633dfb7dd9c8c6a4e70eae to your computer and use it in GitHub Desktop.
super duck punch flash sol save file editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import random | |
def decrypt(input_string, key="keykey"): | |
chars_array = list("e7NjchMCEGgTpsx3mKXbVPiAqn8DLzWo_6.tvwJQ-R0OUrSak954fd2FYyuH~1lIBZ") | |
chars_length = len(chars_array) | |
# MD5 hash of the key | |
key_array = list(hashlib.md5(key.encode()).hexdigest()) | |
# Split the input string into its components | |
random_key_array = list(input_string[:chars_length * 2]) | |
md5_crc = input_string[chars_length * 2:chars_length * 2 + 32] | |
string_array = list(input_string[chars_length * 2 + 32:]) | |
# Decode the random key | |
random_key_dec = [] | |
for i in range(0, len(random_key_array), 2): | |
numeric = chars_array.index(random_key_array[i]) * chars_length | |
numeric += chars_array.index(random_key_array[i + 1]) | |
numeric -= ord(key_array[(i // 2) % len(key_array)]) | |
random_key_dec.append(chr(numeric)) | |
# Decrypt the main string | |
decrypted_string = "" | |
for i in range(0, len(string_array), 2): | |
numeric = chars_array.index(string_array[i]) * chars_length | |
numeric += chars_array.index(string_array[i + 1]) | |
numeric -= ord(random_key_dec[(i // 2) % chars_length]) | |
decrypted_string += chr(numeric) | |
# Validate the MD5 checksum | |
if md5_crc != hashlib.md5(decrypted_string.encode()).hexdigest(): | |
return False | |
return decrypted_string | |
def encrypt(string, key="keykey"): | |
chars_array = list("e7NjchMCEGgTpsx3mKXbVPiAqn8DLzWo_6.tvwJQ-R0OUrSak954fd2FYyuH~1lIBZ") | |
chars_length = len(chars_array) | |
string_array = list(string) | |
key_array = list(hashlib.md5(key.encode()).hexdigest()) | |
random_key_array = [] | |
while len(random_key_array) < chars_length: | |
random_key_array.append(chars_array[random.randint(0, chars_length - 1)]) | |
return_string = "" | |
for i in range(len(string_array)): | |
numeric = ord(string_array[i]) + ord(random_key_array[i % chars_length]) | |
return_string += chars_array[numeric // chars_length] | |
return_string += chars_array[numeric % chars_length] | |
random_key_enc = "" | |
for i in range(chars_length): | |
numeric = ord(random_key_array[i]) + ord(key_array[i % len(key_array)]) | |
random_key_enc += chars_array[numeric // chars_length] | |
random_key_enc += chars_array[numeric % chars_length] | |
return random_key_enc + hashlib.md5(string.encode()).hexdigest() + return_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment