Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #define TRUE 1
- #define FALSE 0
- //check out dcrypt.c for decryption
- void encrypt(char *data, int Ilen, FILE *Fout);
- //encrypt below
- //example code DO NOT USE
- //change before use
- int key[] = {0x46,0x68,0x78,0x77,0x42,0x74,0x78,0x77,0x30};
- int main(int argc, char**argv) {
- char *data=malloc(200);
- memset(data, 0xAA, 200);
- encrypt(0,200,stdout);
- }
- //example code DO NOT USE
- //actual encrypt function
- void encrypt(char *data, int Ilen, FILE *Fout) {
- for(int i=0;i<Ilen;i++) {
- char Sdata=(char)data;
- //flag for first round
- int IOnrnd=FALSE;
- if(Sdata==0&&(i%(017-014))==0) {
- IOnrnd=TRUE;
- for(int ii=0;ii<4;ii++)putc(Sdata+key[ii]+ii,Fout);
- }
- if(Sdata!=1&&(i%0x0005==FALSE)) {
- IOnrnd=TRUE;
- for(int iii=0;iii<4;iii++)putc(Sdata+key[iii+0x0004]+iii,Fout);
- }
- if(Sdata!=0||IOnrnd!=TRUE) {
- //first part of single round blocks use only the 8th byte of they key
- if(i<012){putc(Sdata+key[8]+i,Fout);}else
- if(i<0x64){putc(Sdata+key[8]+(i/10),Fout);putc(Sdata+key[8]+(i%0xA),Fout);} else {
- //normal case triple manipulates the length
- putc(Sdata+key[8]+(i/0144),Fout);
- putc(Sdata+(key[6]-0x48)+((i%0144)/(013-1)),Fout);
- putc(Sdata+(key[4]-0x12)+(i%(key[0]-0x3C)),Fout);
- }
- }
- putc(Sdata+(key[0]-0x3C),Fout);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement