knot126

furries, computers, magic

  • they/them (any are fine)


its bigger. its probably not secure. dont use it.

// XXXTEA
#include <stdio.h>
#include <inttypes.h>

void Encrypt(uint64_t *k, uint64_t *p) {
	uint64_t sum, subkey, mixed, temp;
	
	for (int i = 0; i < 64; i++) {
		sum = ((i + 1) / 2) * 0x9e3779b97f4a7c15;
		subkey = sum + k[((i & 1) ? (sum >> 11) : (sum)) & 3];
		mixed = ((p[1] << 4) ^ (p[1] >> 5)) + p[1];
		
		p[0] += (mixed ^ subkey);
		temp = p[0];
		p[0] = p[1];
		p[1] = temp;
	}
	
	printf("%lx %lx\n", p[0], p[1]);
}

int main() {
	uint64_t key[4] = {0x80, 0, 0, 0};
	uint64_t plain[2] = {0, 0};
	
	Encrypt(&key, &plain);

	return 0;
}

You must log in to comment.