eexec 的加密和解密演算法

來源:互聯網
上載者:User

 #include "stdafx.h"<br />#include <iostream><br />using std::cout;<br />using std::endl;<br />//密碼編譯演算法<br />static unsigned short buffer = 0xd971;<br />static unsigned long startup = 0xac7252f3; /* 00000000or whatever you want */<br />int _tmain(int argc, char* argv[])<br />{<br />unsigned char input;<br />unsigned char output;<br />int init = 4;<br />int i;<br />int result;<br />FILE *infile,*outfile;</p><p>infile=fopen("c://888.txt","r");<br />outfile=fopen("c://999.txt","w");<br />//sscanf(argv[1],"%lx",&startup);<br />fprintf(outfile,"%08lx",startup);<br />for (i=0;i<4;++i)<br />{<br />input = (startup >> ((3-i)*8));<br />buffer = (input + buffer) * 0xce6d + 0x58bf;<br />}<br />for(;;)<br />{<br />for (i=0;i<(32-init);++i)<br />{<br />input = result = fgetc(infile);<br />if ((int)result == EOF)<br />break;<br />output = (input ^ (buffer>>8));<br />buffer = (output + buffer) * 0xce6d + 0x58bf;<br />fprintf(outfile,"%02.2x",output);<br />}<br />init = 0;<br />fprintf(outfile,"/n");<br />if ((int) result == EOF)<br />break;<br />}<br />fclose(infile);<br />fclose(outfile);<br />} 

// Decrpt.cpp : Defines the entry point for the console application.<br />//<br />#include "stdafx.h"<br />//解密演算法<br />int _tmain(int argc, _TCHAR* argv[])<br />{<br />int first =4;<br />int state=0xD971;<br />int c;<br />char decrptd;<br />FILE* infile=fopen("c://456.txt","r");<br />FILE* outfile=fopen("c://345.txt","w");<br />while(fscanf(infile,"%2x",&c)>0)<br />{<br />decrptd= c ^ (state >>8);<br />if(first !=0)<br />{<br />first--;<br />}<br />else<br />{<br />fputc(decrptd,outfile);<br />}<br />state=state + c;<br />state=state * 0xCE6D;<br />state=state + 0x58BF;</p><p>}<br />fclose(infile);<br />fclose(outfile);<br />return 0;<br />}<br />

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.