Skip to content

Commit 041d140

Browse files
committed
Update ciphertext samples
1 parent 8f7fddf commit 041d140

File tree

7 files changed

+9
-7
lines changed

7 files changed

+9
-7
lines changed

fancyDES.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,15 @@ def generate_cipher(self, decrypt=False, mode="ECB"):
281281

282282

283283
if __name__ == '__main__':
284-
fancyDES = FancyDES(path='samples/short.txt',key = 'HELLO WORLD! HAHAHHA', fromFile=True)
284+
MODE = "OFB"
285+
# fancyDES = FancyDES(path='samples/short.txt',key = 'HELLO WORLD! HAHAHHA', fromFile=True)
285286
# fancyDES = FancyDES(path='samples/text.txt',key = 'HELLO WORLD! HAHAHHA', fromFile=True)
286-
# fancyDES = FancyDES(path='samples/lorem-ipsum.txt',key = 'HELLO WORLD! HAHAHHA', fromFile=True)
287+
fancyDES = FancyDES(path='samples/lorem-ipsum.txt',key = 'HELLO WORLD! HAHAHHA', fromFile=True)
287288
#fancyDES = FancyDES(path='LICENSE', key = 'HELLO WORLD! HAHAHHA', fromFile=True)
288289

289290
b = bytearray(fancyDES.message)
290291

291-
cipher = fancyDES.generate_cipher(mode="CBC")
292+
cipher = fancyDES.generate_cipher(mode=MODE)
292293
print('Encrypted:')
293294
print(binascii.hexlify(cipher), len(cipher))
294295

@@ -303,11 +304,11 @@ def generate_cipher(self, decrypt=False, mode="ECB"):
303304
# check changed ciphertext
304305
# cipher[4] += 1
305306

306-
# f = open('samples/output/output-OFB.txt', 'wb')
307-
# f.write(cipher)
308-
# f.close()
307+
f = open('samples/output/output-'+MODE+'.txt', 'wb')
308+
f.write(cipher)
309+
f.close()
309310
fancyDES1 = FancyDES(message=cipher, key = 'HELLO WORLD! HAHAHHA', fromFile=False)
310-
plainteks = fancyDES1.generate_cipher(decrypt=True, mode="CBC")
311+
plainteks = fancyDES1.generate_cipher(decrypt=True, mode=MODE)
311312
print('Decrypted:')
312313
# print(binascii.hexlify(plainteks), len(plainteks))
313314
print(plainteks, len(plainteks))

samples/output/output-CBC.txt

0 Bytes
Binary file not shown.

samples/output/output-CFB.txt

0 Bytes
Binary file not shown.

samples/output/output-CTR.txt

0 Bytes
Binary file not shown.

samples/output/output-ECB.txt

0 Bytes
Binary file not shown.

samples/output/output-OFB.txt

0 Bytes
Binary file not shown.

samples/short.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You can do anything, but not everything.

0 commit comments

Comments
 (0)