Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdint.h>
- #include <string.h>
- void verschluesseln(unsigned long* v, unsigned long* k) {
- unsigned long v0 = v[0], v1 = v[1], sum = 0, i; /* set up */
- unsigned long delta = 0x9e3779b9; /* a key schedule constant */
- unsigned long k0 = k[0], k1 = k[1], k2 = k[2], k3 = k[3]; /* cache key */
- for (i = 0; i < 32; i++) { /* basic cycle start */
- sum += delta;
- v0 += ((v1<<4) + k0) ^ (v1 + sum) ^ ((v1>>5) + k1);
- v1 += ((v0<<4) + k2) ^ (v0 + sum) ^ ((v0>>5) + k3); /* end cycle */
- }
- v[0] = v0; v[1] = v1;
- }
- int main(int argc,char **argv)
- {
- char key[17]={"xdfg19rtbg38:+h<"};
- char bla[1],vbuf[18],buf[256];
- char *inhalt_datei,*output_datei;
- unsigned char d=0;
- int i,c,groesse;
- FILE *pf,*pf1;
- pf=fopen("sehrgeheim.txt","rb");
- fseek(pf,0,SEEK_END);
- groesse=ftell(pf);
- fseek(pf,0,SEEK_SET);
- inhalt_datei=calloc(groesse+1,sizeof(char));
- fread(inhalt_datei,sizeof(char),groesse,pf);
- for(c=0;c<groesse;c+=8)
- {
- verschluesseln((unsigned long*)&inhalt_datei[c],(unsigned long*)vbuf);
- sprintf(buf,".%s",argv[1]);
- }
- if((pf1=fopen(buf,"w+b"))>0)
- {
- fwrite(inhalt_datei,1,groesse,pf1);
- fclose(pf1);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement