Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 5 Apr 2011 02:47:33 +0400
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: Using DES_bs

On Mon, Apr 04, 2011 at 10:35:15AM -0500, Daniel Beard wrote:
> 1) What's the difference between DES_bs and DES_bs_c?

I assume, you ask about DES_bs.c and DES_bs_b.c, correct?  These are two
components of the bitslice DES implementation.  In fact, DES_bs.h (the
header file) includes prototypes for functions exported by both of the C
files at once.

DES_bs.c defines many small functions, which implement DES key setup and
comparison of computed hashes against those loaded for cracking.

DES_bs_b.c defines three DES_bs_crypt*() functions, of which only one is
used at a time (for a given hash type).  It also #include's one of the
DES S-box files (nonstd.c, sboxes.c, or sboxes-s.c) and normally has the
S-boxes inlined into the three functions.

A primary reason for this split is that DES_bs_b.c is sometimes compiled
with different optimization flags to force function inlining.  This is
no longer needed with __attribute__((always_inline)) on gcc 3.1+, but it
was needed with older versions of gcc and it is still needed with other
C compilers.

Also, DES_bs_b.c grew quite large - the current version (in the CVS
repository) is over 1000 lines, two thirds of which are the v*() macro
definitions (different kinds of them) for use by the S-boxes.  The
corresponding version of DES_bs.c is under 500 lines, and it contains
many small and non-redundant functions.  Thus, this split helps
readability, and I am considering a further split of DES_bs_b.c (move
the macros into an include file).

> 2) I understand how to set a salt for DES_bs, but I'm totally confused as to
> how to which function or combination to use on a plaintext key.

It depends on hash type.  Since you mention a salt, you're probably not
talking about LM hashes (which are saltless), so the functions to use
are DES_bs_clear_keys(), DES_bs_set_key(), and then
DES_bs_expand_keys().  See DES_bs.h (the header file) and DES_fmt.c for
some usage hints.  Don't forget to call DES_bs_init(0).

Alexander

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ