void ror() { uint16_t a = GET_EAB; uint8_t t = get_memb(a); ror8(t); set_memb(a, t); }
void unshield_deobfuscate(unsigned char* buffer, size_t size, unsigned* seed) { unsigned tmp_seed = *seed; for (; size > 0; size--, buffer++, tmp_seed++) { *buffer = ror8(*buffer ^ 0xd5, 2) - (tmp_seed % 0x47); } *seed = tmp_seed; }
NC_LIBEXPORT(VOID) ncKeyShift(unsigned char* keybuf, int len) { for(int i = 0; i < (NC_ENC_PASSES - 1); i++) { bool f = false; for(int l = 0; l < len; l++) { if(f) rol8((unsigned char*)&keybuf[l], 2); else ror8((unsigned char*)&keybuf[2], 3); f = !f; } } }
NC_LIBEXPORT(VOID) ncCreateUsageKey(unsigned char* output, unsigned char* key, int len, int rora) { // Setup priv key unsigned char apkey[NC_KEY_MAX_LENGTH]; memcpy(&apkey, &_ncEncPrivkey, NC_PRIV_KEY_LENGTH); // Setup public key unsigned char akey[NC_KEY_MAX_LENGTH]; memcpy(&akey, key, len); // Expand keys ncKeyExpand((unsigned char*)&apkey, NC_PRIV_KEY_LENGTH); ncKeyExpand((unsigned char*)&akey[0], len); // Create usage key for(int ai = 0; ai < NC_KEY_MAX_LENGTH; ai++) { output[ai] = (apkey[ai] ^ akey[ai]) ^ 0xFF; ror8(&output[ai], rora); } }
void rorb() { ror8(rb); }
void rora() { ror8(ra); }