Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4. #include <string.h>
  5.  
  6.  
  7.  
  8.  
  9.  
  10. void verschluesseln(unsigned long* v, unsigned long* k) {
  11.       unsigned long v0 = v[0], v1 = v[1], sum = 0, i;           /* set up */
  12.       unsigned long delta = 0x9e3779b9;                         /* a key schedule constant */
  13.       unsigned long k0 = k[0], k1 = k[1], k2 = k[2], k3 = k[3]; /* cache key */
  14.       for (i = 0; i < 32; i++) {                                /* basic cycle start */
  15.          sum += delta;
  16.          v0 += ((v1<<4) + k0) ^ (v1 + sum) ^ ((v1>>5) + k1);
  17.           v1 += ((v0<<4) + k2) ^ (v0 + sum) ^ ((v0>>5) + k3);   /* end cycle */
  18.       }
  19.       v[0] = v0; v[1] = v1;
  20. }
  21.  
  22. int main(int argc,char **argv)
  23. {
  24.     char key[17]={"xdfg19rtbg38:+h<"};
  25.    char bla[1],vbuf[18],buf[256];
  26.    char *inhalt_datei,*output_datei;
  27.    unsigned char d=0;
  28.    int i,c,groesse;
  29.    FILE *pf,*pf1;
  30.      
  31.    pf=fopen("sehrgeheim.txt","rb");
  32.    
  33.    fseek(pf,0,SEEK_END);
  34.    groesse=ftell(pf);
  35.    fseek(pf,0,SEEK_SET);
  36.    
  37.    inhalt_datei=calloc(groesse+1,sizeof(char));
  38.    fread(inhalt_datei,sizeof(char),groesse,pf);
  39.    
  40.         for(c=0;c<groesse;c+=8)
  41.     {
  42.       verschluesseln((unsigned long*)&inhalt_datei[c],(unsigned long*)vbuf);
  43.       sprintf(buf,".%s",argv[1]);
  44.     }  
  45.     if((pf1=fopen(buf,"w+b"))>0)
  46.     {
  47.       fwrite(inhalt_datei,1,groesse,pf1);
  48.       fclose(pf1);
  49.     }
  50.  
  51.    
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement