2017-03-07 121 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);