Look! I wrote a demo program for "simple XOR" encryption!

Source: Internet
Author: User
Simple or actually very dangerous. This knowledge is seen in the book. I recently held a debate with a friend in this regard, so I was suddenly very interested in this issue. In fact, I have no experience in cryptography analysis, nor have I ever written related programs. Today, it took a day to write out the entire cracking program.
This is the core of the algorithm proposed by the Friend: Char g_szseed [5/** // * 26 */] = {
'A', 'B', 'C', '1', '2 ',
};

Bool compress (lpcstr lpstrsrc, lpstr lpstrden, unsigned long llen ){
_ Assert (llen> 0 );

Size_t nseedcount = sizeof (g_szseed)/sizeof (char );

For (unsigned long I = 0; I <llen; ++ I ){
Char chcurseed = g_szseed [I % nseedcount];

If (* (lpstrsrc + I ))
* (Lpstrden + I) = (chcurseed ^ * (lpstrsrc + I ));
Else
* (Lpstrden + I) = * (lpstrsrc + I );

}


Return true;
}

He wrote C ++ code. I converted it into a C # format. Then, the encrypted ciphertext is attacked, and the length and content of the key are unknown during the attack, it does not involve the encryption algorithm code itself (of course, it involves the relevant knowledge of the encryption algorithm ). Therefore, the attack process is fairly fair.

Do you want to know how I cracked it? Click here to download the source program (including cracking programs, of course ).

After running my program, you should have discovered how easy it is to crack the "simple or" encryption algorithm: the coding time of one day (beginning with no experience in this field), and the running time that cannot be reached in a few seconds, everything is done.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.