newline as input
#1
Hi! I'm trying to crack a challenge that should be pretty easy but I still can't crack it. I suspect that the hash is created "incorrect", where newline is included in the hashed string.

I think the creator of the challenge missed the echo option "-n" when they generated the hashfile.
echo "<secret-string>" | md5sum | awk '{print $1}' > hashfile
instead of
echo -n "<secret-string>" | md5sum | awk '{print $1}' > hashfile

Is there a way to get oclHashcat to keep the newline character when reading from a dictionary? Or add a "new" newline at the end of every word?

This is my first post here on hashcat forum, this endless ocean of knowledge and expertise. I really hope I have searched the forum thoroughly after previously presented solutions on this topic. In thread #1948 M@LIK shows a solution, but he also says that it "only" works with bruteforce/-a3.

Thanks in advance!
#2
you can use ''--hex-charset -1 0A'' with mask & hybrid attacks
#3
As epixoip already mentioned, there are many possibilities to do this.

Depending on the attack mode, there are different possibilities. Some work better some work worse in different situations/scenarios

one simple idea (but maybe not the fastest for you) would be to use $HEX[] words. This works also with -a 1 for instance, but as said it won't be the fastest way to do for instance in -a 1 dict1.txt dict2.txt:
Code:
$ cat dict1.txt
# can be any wordlist
$ cat dict2.txt
$HEX[0a]

Another possibility with $HEX[] would be to simply convert the whole word list(s) into $HEX[] after adding the newline, for instance like this (perl code follows):
Code:
#!/usr/bin/env perl

# Author: philsmd (Nov 2014)

# constants

my $SUFFIX = "\n";

# start

if (scalar (@ARGV) < 1)
{
  print "ERROR: You need to specify the dictionary file\n";

  exit (1);  
}

my $dict = $ARGV[0];
my $output = $dict . "_out.txt";

open (IN,  "<", $dict)   or die "Could not open $dict: $!";
open (OUT, ">", $output) or die "Could not open $output: $!";

binmode IN;

while (my $line = <IN>)
{
  chomp $line;

  if ($line =~ /^\$HEX\[([0-9a-zA-Z]*)\]$/)
  {
    # already $HEX[]

    print OUT $line . "\n";
  }
  else
  {
    my $plain = $line . $SUFFIX;

    my $plain_hex = unpack ("H*", $plain);

    print OUT "\$HEX[$plain_hex]\n";
  }
}

close (OUT);
close (IN);

print "INFO: Successfully saved file to $output\n";

exit (0);


On the other hand, maybe the best method would be to use rules (-r append_0a.rule) in -a 0 mode, where append_0a.rule would contain something like this:
Code:
^[TAB_HERE] +0 {
where you need to replace [TAB_HERE] with a real tab (0x09).

The trick here is, since we can't use 0x0a directly in rule files because it marks of course a new rule line, to prepend a tab, increase the first char i.e. 0x09 to 0x0a and rotate to the left and hence put the 0x0a char with the { rule to the end of the word.

It depends on many factors (maybe also something like disk speed etc), but this last method should be the fastest since rules will be applied by the gpu(s).
Also, you can still use multi-rules (see https://hashcat.net/wiki/doku.php?id=rul...ulti-rules ) in this case the -r append_0a.rule should in general be the last rules you will apply.
In theory, this method could also be the "safest" since with for instance the method I discussed before ($HEX[] word list) it could be possible that some rules truncate the plain (and hence the newline char 0x0a is gone).

On the other hand, with the $HEX[] word list you do not need to apply any rules. If you apply some rules with this method, you risk that the final 0x0a won't end up in the final plain (since manipulated/truncated by some rules).
#4
As I said: ".. hashcat forum, this endless ocean of knowledge and expertise."

This time I converted the whole word list(s) into $HEX[] and it worked like a charm. I will put the other metods into the memory.

Thanks a lot for you time and effort.