Skip to content

Commit

Permalink
Add emulateme.tricore
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed Jan 10, 2024
1 parent 5d56d09 commit 6de0330
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tricore/emulateme.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <assert.h>

#define LEN 0x10

static const uint8_t parity_ref = 0x58;
static char seckrit[LEN + 1] = { 0x51, 0x53, 0x4d, 0x77, 0x58, 0x14, 0x51, 0x5f, 0x45, 0x6c, 0x17, 0x7f, 0x6e, 0x78, 0x7f, 0x1c };

int decrypt(const char *key) {
uint8_t parity = 0;
for (size_t i = 0; i < LEN; i++) {
seckrit[i] ^= key[i];
parity ^= seckrit[i];
}
if (parity != parity_ref) {
return 0;
}
for (size_t i = 0; i < LEN; i++) {
seckrit[i] ^= parity;
}
return 1;
}

int main(int argc, const char *argv[]) {
const char *key = "AnyColourYouLike";
assert(decrypt(key));
printf("Decrypted: %s\n", seckrit);
return 0;
}
Binary file added tricore/emulateme.tricore
Binary file not shown.

0 comments on commit 6de0330

Please sign in to comment.