Skip to content

Commit

Permalink
Add emulateme.pic18f2520.elf (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow authored May 1, 2024
1 parent b183fa7 commit cbbfa29
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pic/emulateme.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <stdint.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 };

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

int main(int argc, const char *argv[]) {
const char *key = "AnyColourYouLike";
decrypt(key);
return 0;
}
Binary file added pic/emulateme.pic18f2520.elf
Binary file not shown.

0 comments on commit cbbfa29

Please sign in to comment.