summaryrefslogtreecommitdiff
path: root/cstrobf.c
blob: 743285dad48093c6160ddcf7fecf9d19fdda1905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * LOKI3
 *
 * [ cstrobf.c ]
 *
 *  2019 and beyond Elective Surgery        [dmfr]
 */

#include "cstrobf.h"


char *decrypt(estring encrypted) {
	int i;
	char buf[CSTROBF_MAX] = {0};

	for (i = 0; i < encrypted.size; i++)
		buf[i] = encrypted.str[i] ^ encrypted.key[i % encrypted.ksize];

	return strdup(buf);
}


void destroy(char *buf, size_t len) {
	for(int i = 0; i < len; i++)
		buf[i] = rand() % 256;
	free(buf);
}