2017-03-07 119 views
-1

我试图编程蛮力攻击,这个想法是:蛮力攻击(解密)AES

  • 我已经有密文加密后
  • 我有第4信纯文本(这是41个字符)
  • 的我的秘密密钥

第12字符我需要的是找到丢失的4个字符

假设我有钥匙:

"ABCDEFGHIJ????" 

如何申请强力攻击,以寻找失踪的性格?

+1

你知道加密模式吗? http://stackoverflow.com/questions/1220751/how-to-choose-an-aes-encryption-mode-cbc-ecb-ctr-ocb-cfb –

回答

0

有2^32的可能性失踪的4个关键字节。这符合一个无符号的32位整数。因此,循环这个unsigned int的所有可能性,从整数值中取出四个丢失的字节。在C中,像这样:

unsigned int i = 0; 

do { 
    first candidate missing byte for key = i&255; 
    second candidate missing byte for key = (i>>8)&255; 
    third candidate missing byte for key = (i>>16)&255; 
    fourth candidate missing byte for key = (i>>24)i&255; 
    /* here: try the candidate with your AES encryption, break if it works */ 
    ++i; 
} while (i != 0);