QString Crypter::desencrypt(const QString &word) { w = word; doXor(); doRot13(); doSwap(); return w; }
void* Encrypt::encryptWithoutZip(int* dstLength,void* src,int srcLength) { int xorLen; void* xorData = doXor(&xorLen,src,srcLength); if(xorData == NULL) { return NULL; } *dstLength = xorLen; return xorData; }
void* Encrypt::encrypt(int* dstLength,void* src,int srcLength) { int zipLen; void* zipData = doZip(&zipLen,src,srcLength); if(zipData == NULL) { return NULL; } int xorLen; void* xorData = doXor(&xorLen,zipData,zipLen); delete[]((char *) zipData); if(xorData == NULL) { return NULL; } *dstLength = xorLen; return xorData; }
void execute(pruCPU *cpu) { aluInstruction inst; fmt2InstructionHeader fmt2Hdr; while(1) { int didBranch = 0; cgc_memcpy(&inst, (aluInstruction *)&cpu->code[cpu->pc], 4); switch(inst.opFmt) { case 0b000: switch(inst.aluOp) { case ADD: doAdd(cpu, inst); break; case ADC: doAdc(cpu, inst); break; case SUB: doSub(cpu, inst); break; case SUC: doSuc(cpu, inst); break; case LSL: doLsl(cpu, inst); break; case LSR: doLsr(cpu, inst); break; case RSB: doRsb(cpu, inst); break; case RSC: doRsc(cpu, inst); break; case AND: doAnd(cpu, inst); break; case OR: doOr(cpu, inst); break; case XOR: doXor(cpu, inst); break; case NOT: doNot(cpu, inst); break; case MIN: doMin(cpu, inst); break; case MAX: doMax(cpu, inst); break; case CLR: doClr(cpu, inst); break; case SET: doSet(cpu, inst); break; } break; case 0b001: cgc_memcpy(&fmt2Hdr, &inst, sizeof(fmt2Hdr)); switch(fmt2Hdr.subOp) { case JMP: case JAL: ; fmt2BranchInstruction fmt2Branch; cgc_memcpy(&fmt2Branch, &inst, 4); doBranch(cpu, fmt2Branch); didBranch = 1; break; case LDI: ; fmt2LdiInstruction fmt2Ldi; cgc_memcpy(&fmt2Ldi, &inst, 4); doLdi(cpu, fmt2Ldi); break; case LMBD: ; fmt2LmbdInstruction fmt2Lmbd; cgc_memcpy(&fmt2Lmbd, &inst, 4); doLmbd(cpu, fmt2Lmbd); break; case HALT: return; case SCAN: ; fmt2ScanInstruction fmt2Scan; cgc_memcpy(&fmt2Scan, &inst, 4); doScan(cpu, fmt2Scan); break; case SLP: case RESERVED_1: case RESERVED_2: case RESERVED_3: case RESERVED_4: case RESERVED_5: case RESERVED_6: case RESERVED_7: case RESERVED_8: case RESERVED_9: return; } break; case 0b11: ; fmtQatbInstruction qatbInstruction; cgc_memcpy(&qatbInstruction, &inst, 4); doQATB(cpu, qatbInstruction); default: return; } if(didBranch == 0) cpu->pc++; cpu->numExecuted++; if(cpu->numExecuted >= MAX_INSNS) return; } }