mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Add reference Python script
This commit is contained in:
parent
3014696fcd
commit
9872578d51
1 changed files with 20 additions and 1 deletions
|
@ -1372,8 +1372,27 @@ DES uses a key length of 8 bytes (64 bits).`,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
/* The following expectedOutputs are generated with this Python script with pyCryptoDome
|
||||||
|
from Crypto.Cipher import Blowfish
|
||||||
|
import binascii
|
||||||
|
|
||||||
// The following expectedOutputs are generated with pyCryptoDome
|
input_data = b"The quick brown fox jumps over the lazy dog."
|
||||||
|
key = binascii.unhexlify("0011223344556677")
|
||||||
|
iv = binascii.unhexlify("0000000000000000")
|
||||||
|
mode = Blowfish.MODE_CBC
|
||||||
|
|
||||||
|
if mode == Blowfish.MODE_ECB or mode == Blowfish.MODE_CBC:
|
||||||
|
padding_len = 8-(len(input_data) & 7)
|
||||||
|
for i in range(padding_len):
|
||||||
|
input_data += bytes([padding_len])
|
||||||
|
|
||||||
|
cipher = Blowfish.new(key, mode) # set iv, nonce, segment_size etc. here
|
||||||
|
cipher_text = cipher.encrypt(input_data)
|
||||||
|
|
||||||
|
cipher_text = binascii.hexlify(cipher_text).decode("UTF-8")
|
||||||
|
|
||||||
|
print("Encrypted: {}".format(cipher_text))
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
name: "Blowfish Encrypt: ECB, ASCII",
|
name: "Blowfish Encrypt: ECB, ASCII",
|
||||||
input: "The quick brown fox jumps over the lazy dog.",
|
input: "The quick brown fox jumps over the lazy dog.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue