Need to find X in SHA1[(AES-128(X)]
#3
(12-30-2014, 04:55 PM)atom Wrote: I wrote a little code for you that should solve the problem:

Code:
#!/usr/bin/env perl

use strict;
use warnings;
use Digest::SHA qw (sha1_hex);
use Crypt::CBC;
use Crypt::Rijndael;

my $hc     = "\x68\x61\x73\x68\x63\x61\x74\x00";
my $key    = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
my $iv     = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
my $suffix = $ARGV[0];

my $i = 1;

while ($i++)
{
  my $cipher = Crypt::CBC->new({
    key         => $key,
    cipher      => "Crypt::Rijndael",
    iv          => $iv,
    literal_key => 1,
    header      => "none",
    keysize     => 16,
    padding     => "none",
  });

  my $pt = $hc . pack ("Q", $i);

  my $ct = $cipher->encrypt ($pt);

  my $hash = sha1_hex ($ct);

  next unless $hash =~ /$suffix$/;

  printf "pt: %s\n", unpack ("H*", $pt);
  printf "ct: %s\n", unpack ("H*", $ct);

  printf "hash: %s\n", $hash;

  last;
}

Quote:root@et:~/oclHashcat-1.32# perl sha1aes128date.pl 0402
pt: 68617368636174006d1c010000000000
ct: 381b9a3dd48c5bff7d1791c86375e56e
hash: a0676d214b22e0bc80f4e14e2892dbd42c8f0402
root@et:~/oclHashcat-1.32# perl -e 'print pack ("H*", "68617368636174006d1c010000000000")' | openssl enc -aes-128-cbc -K 00000000000000000000000000000000 -iv 00000000000000000000000000000000 -nopad | sha1sum
a0676d214b22e0bc80f4e14e2892dbd42c8f0402 -

If I understand correctly I have to run the code myself right? Because if I do my terminal says "Can't locate Crypt/CBC.pm in @inc". I download Crypt.CBC.2.22.tar.gz, but is it the right one, where do I have to install it?

Or am I completely misunderstanding?


Messages In This Thread
RE: Need to find X in SHA1[(AES-128(X)] - by atom - 12-30-2014, 04:55 PM
RE: Need to find X in SHA1[(AES-128(X)] - by DramaticTical - 12-30-2014, 05:33 PM
RE: Need to find X in SHA1[(AES-128(X)] - by atom - 12-31-2014, 04:15 PM
RE: Need to find X in SHA1[(AES-128(X)] - by atom - 12-31-2014, 04:30 PM