source: trunk/lib/bletchley/known.py

Last change on this file was 1, checked in by tmorgan, 12 years ago

moved to dedicated repository

File size: 1.1 KB
Line 
1'''
2A collection of tools to assist in analyzing encrypted blobs of data
3through known plaintext attacks.
4
5Copyright (C) 2011-2012 Virtual Security Research, LLC
6Author: Timothy D. Morgan
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License, version 3,
10 as published by the Free Software Foundation.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program.  If not, see <http://www.gnu.org/licenses/>.
19'''
20
21from buffertools import xorBuffers
22
23# Attack OFB mode with static IV
24#
25def OFB_TestKnownPlaintext(plaintext, ciphertext1, ciphertext2):
26    ret_val = []
27
28    p1p2 = xorBuffers(ciphertext1,ciphertext2)
29    for i in range(0,len(p1p2)-len(plaintext)):
30        ret_val.append(xorBuffers(p1p2[i:i+len(plaintext)], plaintext))
31       
32    return ret_val
33
Note: See TracBrowser for help on using the repository browser.