Last active
April 29, 2022 12:20
-
-
Save DrinkyBird/f47ac51cba9f685cedfecbfb49f947cf to your computer and use it in GitHub Desktop.
The Stanley Parable: Ultra Deluxe save file (de/en)cryptor. https://drinkybird.net/files/misc/tspuddec.exe
This file contains 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
// To use, pass the input file and output file | |
// e.g.: tspuddec.exe "C:\Users\Sean\AppData\LocalLow\Crows Crows Crows\The Stanley Parable_ Ultra Deluxe\tspud-savedata.txt" data.json | |
// The algorithm is a simple XOR and works both ways, so you can swap the parameters to encrypt again. | |
// The save file is a JSON file, which then contains JSON data as a string. Fun to edit... | |
#include <stdio.h> | |
#include <string.h> | |
static const char *ENCRYPTION_KEY = "saRpmZ6mMgZpmcojUkvkyGEQGez9YkWoXZfJdRc9ZmmJrCzfM8JksVxQfQK8uBBs"; | |
int main(int argc, char *argv[]) { | |
if (argc < 3) { | |
printf("Usage: %s <input file> <output file>\n", argv[0]); | |
return 1; | |
} | |
FILE *input = fopen(argv[1], "rb"); | |
if (input == NULL) { | |
printf("Failed to open input file %s\n", argv[1]); | |
} | |
FILE *output = fopen(argv[2], "wb"); | |
if (output == NULL) { | |
printf("Failed to open output file %s\n", argv[2]); | |
} | |
size_t i = 0; | |
while (1) { | |
char b; | |
if (fread(&b, sizeof(char), 1, input) != 1) break; | |
b ^= ENCRYPTION_KEY[i % strlen(ENCRYPTION_KEY)]; | |
fwrite(&b, sizeof(char), 1, output); | |
i++; | |
} | |
fclose(output); | |
fclose(input); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment