1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 09:58:16 +00:00
This commit is contained in:
Jens Steube 2020-08-29 16:12:37 +02:00
commit 3ebf4c5f9f
15 changed files with 82 additions and 73 deletions

View File

@ -18,6 +18,7 @@
- Fixed internal access on module option attribute OPTS_TYPE_SUGGEST_KG with the result that it was unused - Fixed internal access on module option attribute OPTS_TYPE_SUGGEST_KG with the result that it was unused
- Fixed race condition resulting in out of memory error on startup if multiple hashcat instances are started at the same time - Fixed race condition resulting in out of memory error on startup if multiple hashcat instances are started at the same time
- Fixed unexpected non-unique salts in multi-hash cracking in Bitcoin/Litecoin wallet.dat module which lead to false negatives - Fixed unexpected non-unique salts in multi-hash cracking in Bitcoin/Litecoin wallet.dat module which lead to false negatives
- Fixed rare case of misalignment of the status prompt when other user warnings are shown within the hashcat output
## ##
## Improvements ## Improvements
@ -33,6 +34,8 @@
- Module Structure: Add 3rd party library hook management functions. This also requires an update to all existing module_init() - Module Structure: Add 3rd party library hook management functions. This also requires an update to all existing module_init()
- Hash-Mode 13200 (AxCrypt): Changed the name to AxCrypt 1 to avoid confusion - Hash-Mode 13200 (AxCrypt): Changed the name to AxCrypt 1 to avoid confusion
- Hash-Mode 13300 (AxCrypt in-memory SHA1): Changed the name to AxCrypt 1 in-memory SHA1 - Hash-Mode 13300 (AxCrypt in-memory SHA1): Changed the name to AxCrypt 1 in-memory SHA1
- Unit tests: Added Python 3 support for all of the Python code in our test framework
- Unit tests: Fixed the packaging of test (-p) feature
* changes v6.1.0 -> v6.1.1 * changes v6.1.0 -> v6.1.1

View File

@ -23,6 +23,7 @@
#include "event.h" #include "event.h"
#include "dynloader.h" #include "dynloader.h"
#include "backend.h" #include "backend.h"
#include "terminal.h"
#if defined (__linux__) #if defined (__linux__)
static const char *dri_card0_path = "/dev/dri/card0"; static const char *dri_card0_path = "/dev/dri/card0";
@ -6892,6 +6893,8 @@ void backend_ctx_devices_update_power (hashcat_ctx_t *hashcat_ctx)
{ {
if (user_options->quiet == false) if (user_options->quiet == false)
{ {
clear_prompt (hashcat_ctx);
event_log_advice (hashcat_ctx, "The wordlist or mask that you are using is too small."); event_log_advice (hashcat_ctx, "The wordlist or mask that you are using is too small.");
event_log_advice (hashcat_ctx, "This means that hashcat cannot use the full parallel power of your device(s)."); event_log_advice (hashcat_ctx, "This means that hashcat cannot use the full parallel power of your device(s).");
event_log_advice (hashcat_ctx, "Unless you supply more work, your cracking speed will drop."); event_log_advice (hashcat_ctx, "Unless you supply more work, your cracking speed will drop.");

View File

@ -239,6 +239,8 @@ static void main_cracker_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB
{ {
event_log_info_nn (hashcat_ctx, NULL); event_log_info_nn (hashcat_ctx, NULL);
clear_prompt (hashcat_ctx);
send_prompt (hashcat_ctx); send_prompt (hashcat_ctx);
} }
} }

View File

@ -18,6 +18,7 @@ cpan install Authen::Passphrase::LANManager \
Convert::EBCDIC \ Convert::EBCDIC \
Crypt::CBC \ Crypt::CBC \
Crypt::DES \ Crypt::DES \
Crypt::DES_EDE3 \
Crypt::Digest::RIPEMD160 \ Crypt::Digest::RIPEMD160 \
Crypt::Digest::Whirlpool \ Crypt::Digest::Whirlpool \
Crypt::ECB \ Crypt::ECB \
@ -63,13 +64,13 @@ cpan install Authen::Passphrase::LANManager \
ERRORS=$((ERRORS+$?)) ERRORS=$((ERRORS+$?))
pip2 install pygost pip install pygost
# pip2 uninstall -y pycryptoplus pycrypto pycryptodome # pip uninstall -y pycryptoplus pycrypto pycryptodome
pip2 install pycryptoplus pip install pycryptoplus
pip2 uninstall -y pycryptodome pip uninstall -y pycryptodome
pip2 install pycrypto pip install pycrypto
ERRORS=$((ERRORS+$?)) ERRORS=$((ERRORS+$?))

View File

@ -3346,6 +3346,6 @@ if [ "${PACKAGE}" -eq 1 ]; then
-e "s/^\(ATTACK\)=0/\1=${ATTACK}/" \ -e "s/^\(ATTACK\)=0/\1=${ATTACK}/" \
"${OUTD}/test.sh" "${OUTD}/test.sh"
"${PACKAGE_CMD}" "${OUTD}/${OUTD}.7z" "${OUTD}/" >/dev/null 2>/dev/null ${PACKAGE_CMD} "${OUTD}/${OUTD}.7z" "${OUTD}/" >/dev/null 2>/dev/null
fi fi

View File

@ -16,18 +16,17 @@ sub module_generate_hash
# PyGOST outputs digests in little-endian order, while the kernels # PyGOST outputs digests in little-endian order, while the kernels
# expect them in big-endian; hence the digest[::-1] mirroring. # expect them in big-endian; hence the digest[::-1] mirroring.
# Using sys.stdout.write instead of print to disable \n character.
my $python_code = <<"END_CODE"; my $python_code = <<"END_CODE";
import binascii import binascii
import sys import sys
from pygost import gost34112012256 from pygost import gost34112012256
digest = gost34112012256.new (b"$word").digest () digest = gost34112012256.new (b"$word").digest ()
sys.stdout.write (binascii.hexlify (digest[::-1])) print (binascii.hexlify (digest[::-1]).decode (), end = "")
END_CODE END_CODE
my $hash = `python2 -c '$python_code'`; my $hash = `python -c '$python_code'`;
return $hash; return $hash;
} }

View File

@ -23,11 +23,11 @@ from pygost import gost34112012256
key = b"$word" key = b"$word"
msg = b"$salt" msg = b"$salt"
digest = hmac.new (key, msg, gost34112012256).digest () digest = hmac.new (key, msg, gost34112012256).digest ()
sys.stdout.write (binascii.hexlify (digest[::-1])) print (binascii.hexlify (digest[::-1]).decode (), end = "")
END_CODE END_CODE
my $digest = `python2 -c '$python_code'`; my $digest = `python -c '$python_code'`;
my $hash = sprintf ("%s:%s", $digest, $salt); my $hash = sprintf ("%s:%s", $digest, $salt);

View File

@ -23,11 +23,11 @@ from pygost import gost34112012256
key = b"$salt" key = b"$salt"
msg = b"$word" msg = b"$word"
digest = hmac.new (key, msg, gost34112012256).digest () digest = hmac.new (key, msg, gost34112012256).digest ()
sys.stdout.write (binascii.hexlify (digest[::-1])) print (binascii.hexlify (digest[::-1]).decode (), end = "")
END_CODE END_CODE
my $digest = `python2 -c '$python_code'`; my $digest = `python -c '$python_code'`;
my $hash = sprintf ("%s:%s", $digest, $salt); my $hash = sprintf ("%s:%s", $digest, $salt);

View File

@ -20,11 +20,11 @@ import binascii
import sys import sys
from pygost import gost34112012512 from pygost import gost34112012512
digest = gost34112012512.new (b"$word").digest () digest = gost34112012512.new (b"$word").digest ()
sys.stdout.write (binascii.hexlify (digest[::-1])) print (binascii.hexlify (digest[::-1]).decode (), end = "")
END_CODE END_CODE
my $hash = `python2 -c '$python_code'`; my $hash = `python -c '$python_code'`;
return $hash; return $hash;
} }

View File

@ -24,11 +24,11 @@ from pygost import gost34112012512
key = b"$word" key = b"$word"
msg = b"$salt" msg = b"$salt"
digest = hmac.new (key, msg, gost34112012512).digest () digest = hmac.new (key, msg, gost34112012512).digest ()
sys.stdout.write (binascii.hexlify (digest[::-1])) print (binascii.hexlify (digest[::-1]).decode (), end = "")
END_CODE END_CODE
my $digest = `python2 -c '$python_code'`; my $digest = `python -c '$python_code'`;
my $hash = sprintf ("%s:%s", $digest, $salt); my $hash = sprintf ("%s:%s", $digest, $salt);

View File

@ -24,11 +24,11 @@ from pygost import gost34112012512
key = b"$salt" key = b"$salt"
msg = b"$word" msg = b"$word"
digest = hmac.new (key, msg, gost34112012512).digest () digest = hmac.new (key, msg, gost34112012512).digest ()
sys.stdout.write (binascii.hexlify (digest[::-1])) print (binascii.hexlify (digest[::-1]).decode (), end = "")
END_CODE END_CODE
my $digest = `python2 -c '$python_code'`; my $digest = `python -c '$python_code'`;
my $hash = sprintf ("%s:%s", $digest, $salt); my $hash = sprintf ("%s:%s", $digest, $salt);

View File

@ -34,11 +34,11 @@ key = (key1, key2)
cipher = AES.new (key, AES.MODE_XTS) cipher = AES.new (key, AES.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
encrypted = cipher.encrypt (base64.b64decode (data), sequence) encrypted = cipher.encrypt (base64.b64decode (data), sequence)
print encrypted.encode ("hex") print (encrypted.hex ())
END_CODE END_CODE
@ -48,7 +48,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -77,11 +77,11 @@ key = (key1, key2)
cipher = AES.new (key, AES.MODE_XTS) cipher = AES.new (key, AES.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
decrypted = cipher.decrypt (base64.b64decode (data), sequence) decrypted = cipher.decrypt (base64.b64decode (data), sequence)
print decrypted.encode ("hex") print (decrypted.hex ())
END_CODE END_CODE
@ -91,7 +91,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -122,11 +122,11 @@ key = (key1, key2)
cipher = python_Twofish.new (key, python_Twofish.MODE_XTS) cipher = python_Twofish.new (key, python_Twofish.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
encrypted = cipher.encrypt (base64.b64decode (data), sequence) encrypted = cipher.encrypt (base64.b64decode (data), sequence)
print encrypted.encode ("hex") print (encrypted.hex ())
END_CODE END_CODE
@ -136,7 +136,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -165,11 +165,11 @@ key = (key1, key2)
cipher = python_Twofish.new (key, python_Twofish.MODE_XTS) cipher = python_Twofish.new (key, python_Twofish.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
decrypted = cipher.decrypt (base64.b64decode (data), sequence) decrypted = cipher.decrypt (base64.b64decode (data), sequence)
print decrypted.encode ("hex") print (decrypted.hex ())
END_CODE END_CODE
@ -179,7 +179,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -210,11 +210,11 @@ key = (key1, key2)
cipher = python_Serpent.new (key, python_Serpent.MODE_XTS) cipher = python_Serpent.new (key, python_Serpent.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
encrypted = cipher.encrypt (base64.b64decode (data), sequence) encrypted = cipher.encrypt (base64.b64decode (data), sequence)
print encrypted.encode ("hex") print (encrypted.hex ())
END_CODE END_CODE
@ -224,7 +224,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -253,11 +253,11 @@ key = (key1, key2)
cipher = python_Serpent.new (key, python_Serpent.MODE_XTS) cipher = python_Serpent.new (key, python_Serpent.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
decrypted = cipher.decrypt (base64.b64decode (data), sequence) decrypted = cipher.decrypt (base64.b64decode (data), sequence)
print decrypted.encode ("hex") print (decrypted.hex ())
END_CODE END_CODE
@ -267,7 +267,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;

View File

@ -34,11 +34,11 @@ key = (key1, key2)
cipher = AES.new (key, AES.MODE_XTS) cipher = AES.new (key, AES.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
encrypted = cipher.encrypt (base64.b64decode (data), sequence) encrypted = cipher.encrypt (base64.b64decode (data), sequence)
print encrypted.encode ("hex") print (encrypted.hex ())
END_CODE END_CODE
@ -48,7 +48,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -77,11 +77,11 @@ key = (key1, key2)
cipher = AES.new (key, AES.MODE_XTS) cipher = AES.new (key, AES.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
decrypted = cipher.decrypt (base64.b64decode (data), sequence) decrypted = cipher.decrypt (base64.b64decode (data), sequence)
print decrypted.encode ("hex") print (decrypted.hex ())
END_CODE END_CODE
@ -91,7 +91,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -122,11 +122,11 @@ key = (key1, key2)
cipher = python_Twofish.new (key, python_Twofish.MODE_XTS) cipher = python_Twofish.new (key, python_Twofish.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
encrypted = cipher.encrypt (base64.b64decode (data), sequence) encrypted = cipher.encrypt (base64.b64decode (data), sequence)
print encrypted.encode ("hex") print (encrypted.hex ())
END_CODE END_CODE
@ -136,7 +136,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -165,11 +165,11 @@ key = (key1, key2)
cipher = python_Twofish.new (key, python_Twofish.MODE_XTS) cipher = python_Twofish.new (key, python_Twofish.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
decrypted = cipher.decrypt (base64.b64decode (data), sequence) decrypted = cipher.decrypt (base64.b64decode (data), sequence)
print decrypted.encode ("hex") print (decrypted.hex ())
END_CODE END_CODE
@ -179,7 +179,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -210,11 +210,11 @@ key = (key1, key2)
cipher = python_Serpent.new (key, python_Serpent.MODE_XTS) cipher = python_Serpent.new (key, python_Serpent.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
encrypted = cipher.encrypt (base64.b64decode (data), sequence) encrypted = cipher.encrypt (base64.b64decode (data), sequence)
print encrypted.encode ("hex") print (encrypted.hex ())
END_CODE END_CODE
@ -224,7 +224,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -253,11 +253,11 @@ key = (key1, key2)
cipher = python_Serpent.new (key, python_Serpent.MODE_XTS) cipher = python_Serpent.new (key, python_Serpent.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
decrypted = cipher.decrypt (base64.b64decode (data), sequence) decrypted = cipher.decrypt (base64.b64decode (data), sequence)
print decrypted.encode ("hex") print (decrypted.hex ())
END_CODE END_CODE
@ -267,7 +267,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;

View File

@ -34,11 +34,11 @@ key = (key1, key2)
cipher = AES.new (key, AES.MODE_XTS) cipher = AES.new (key, AES.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
encrypted = cipher.encrypt (base64.b64decode (data), sequence) encrypted = cipher.encrypt (base64.b64decode (data), sequence)
print encrypted.encode ("hex") print (encrypted.hex ())
END_CODE END_CODE
@ -48,7 +48,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -77,11 +77,11 @@ key = (key1, key2)
cipher = AES.new (key, AES.MODE_XTS) cipher = AES.new (key, AES.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
decrypted = cipher.decrypt (base64.b64decode (data), sequence) decrypted = cipher.decrypt (base64.b64decode (data), sequence)
print decrypted.encode ("hex") print (decrypted.hex ())
END_CODE END_CODE
@ -91,7 +91,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -122,11 +122,11 @@ key = (key1, key2)
cipher = python_Twofish.new (key, python_Twofish.MODE_XTS) cipher = python_Twofish.new (key, python_Twofish.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
encrypted = cipher.encrypt (base64.b64decode (data), sequence) encrypted = cipher.encrypt (base64.b64decode (data), sequence)
print encrypted.encode ("hex") print (encrypted.hex ())
END_CODE END_CODE
@ -136,7 +136,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -165,11 +165,11 @@ key = (key1, key2)
cipher = python_Twofish.new (key, python_Twofish.MODE_XTS) cipher = python_Twofish.new (key, python_Twofish.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
decrypted = cipher.decrypt (base64.b64decode (data), sequence) decrypted = cipher.decrypt (base64.b64decode (data), sequence)
print decrypted.encode ("hex") print (decrypted.hex ())
END_CODE END_CODE
@ -179,7 +179,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -210,11 +210,11 @@ key = (key1, key2)
cipher = python_Serpent.new (key, python_Serpent.MODE_XTS) cipher = python_Serpent.new (key, python_Serpent.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
encrypted = cipher.encrypt (base64.b64decode (data), sequence) encrypted = cipher.encrypt (base64.b64decode (data), sequence)
print encrypted.encode ("hex") print (encrypted.hex ())
END_CODE END_CODE
@ -224,7 +224,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;
@ -253,11 +253,11 @@ key = (key1, key2)
cipher = python_Serpent.new (key, python_Serpent.MODE_XTS) cipher = python_Serpent.new (key, python_Serpent.MODE_XTS)
sequence = "01".decode ("hex") sequence = b"\x01"
decrypted = cipher.decrypt (base64.b64decode (data), sequence) decrypted = cipher.decrypt (base64.b64decode (data), sequence)
print decrypted.encode ("hex") print (decrypted.hex ())
END_CODE END_CODE
@ -267,7 +267,7 @@ END_CODE
$python_code =~ s/key_tweak/"$key_tweak"/; $python_code =~ s/key_tweak/"$key_tweak"/;
$python_code =~ s/data/"$data_base64"/; $python_code =~ s/data/"$data_base64"/;
my $output_buf = `python2 -c '$python_code'`; my $output_buf = `python -c '$python_code'`;
$output_buf =~ s/[\r\n]//g; $output_buf =~ s/[\r\n]//g;

View File

@ -9,6 +9,7 @@ use strict;
use warnings; use warnings;
use Crypt::CBC; use Crypt::CBC;
use Crypt::DES_EDE3;
use Digest::MD5 qw (md5); use Digest::MD5 qw (md5);
sub module_constraints { [[0, 256], [16, 16], [-1, -1], [-1, -1], [-1, -1]] } sub module_constraints { [[0, 256], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }