Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wim Lewis
nettle
Commits
638937f0
Commit
638937f0
authored
Jun 17, 2001
by
Niels Möller
Browse files
Added descriptions of more block ciphers.
Rev: src/nettle/nettle.texinfo:1.2
parent
08b250a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
nettle.texinfo
View file @
638937f0
...
...
@@ -588,18 +588,227 @@ them one after another. The result is the same as if you had called
@subsection CAST128
CAST-128 is a block cipher, specified in @cite
{
RFC 2144
}
. It uses a 64
bit (8 octets) block size, and a variable key size of up to 128 bits.
Nettle defines cast128 in @file
{
<nettle/cast128.h>
}
.
@deftp
{
Context struct
}
{
struct cast128
_
ctx
}
@end deftp
@defvr Constant CAST128
_
BLOCK
_
SIZE
The CAST128 blocksize, 8
@end defvr
@defvr Constant CAST128
_
MIN
_
KEY
_
SIZE
Minumim CAST128 key size, 5
@end defvr
@defvr Constant CAST128
_
MAX
_
KEY
_
SIZE
Maximum CAST128 key size, 16
@end defvr
@defvr Constant CAST128
_
KEY
_
SIZE
Default CAST128 key size, 16
@end defvr
@deftypefun void cast128
_
set
_
key (struct cast128
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
Initialize the cipher. The same function is used for both encryption and
decryption.
@end deftypefun
@deftypefun void cast128
_
encrypt (struct cast128
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Encryption function. @var
{
length
}
must be an integral multiple of the
block size. If it is more than one block, the data is processed in ECB
mode. @code
{
src
}
and @code
{
dst
}
may be equal, but they must not overlap
in any other way.
@end deftypefun
@deftypefun void cast128
_
decrypt (struct cast128
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Analogous to @code
{
cast128
_
encrypt
}
@end deftypefun
@subsection BLOWFISH
BLOWFISH is a block cipher designed by Bruce Schneier. It uses a block
size of 64 bits (8 octets), and a variable key size, up to 448 bits. It
has some weak keys. Nettle defines BLOWFISH in @file
{
<nettle/blowfish.h>
}
.
@deftp
{
Context struct
}
{
struct blowfish
_
ctx
}
@end deftp
@defvr Constant BLOWFISH
_
BLOCK
_
SIZE
The BLOWFISH blocksize, 8
@end defvr
@defvr Constant BLOWFISH
_
MIN
_
KEY
_
SIZE
Minimum BLOWFISH key size, 8
@end defvr
@defvr Constant BLOWFISH
_
MAX
_
KEY
_
SIZE
Maximum BLOWFISH key size, 56
@end defvr
@defvr Constant BLOWFISH
_
KEY
_
SIZE
Default BLOWFISH key size, 16
@end defvr
@deftypefun int blowfish
_
set
_
key (struct blowfish
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
Initialize the cipher. The same function is used for both encryption and
decryption. Returns 1 on success, and 0 if the key was weak. Calling
@code
{
blowfish
_
encrypt
}
or @code
{
blowfish
_
decrypt
}
with a weak key will
crash with an assert violation.
@end deftypefun
@deftypefun void blowfish
_
encrypt (struct blowfish
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Encryption function. @var
{
length
}
must be an integral multiple of the
block size. If it is more than one block, the data is processed in ECB
mode. @code
{
src
}
and @code
{
dst
}
may be equal, but they must not overlap
in any other way.
@end deftypefun
@deftypefun void blowfish
_
decrypt (struct blowfish
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Analogous to @code
{
blowfish
_
encrypt
}
@end deftypefun
@subsection DES
DES is the old Data Encryption Standard, specified by NIST. It uses a
block size of 64 bits (8 octets), and a key size of 56 bits. However,
the key bits are distributed over 8 octets, where the least significant
bit of each octet is used for parity. A common way to use DES is to
generate 8 random octets in some way, then set the least significant bit
of each octet to get odd parity, and initialize DES with the resulting
key.
The key size of DES is so small that keys can be found by brute force,
using specialized hardware or lots of ordinary work stations in
parallell. One shouldn't be using plain DES at all today, if one uses
DES at all one should be using "triple DES", three DES ciphers piped
together, with three (or sometimes just two) independent keys.
DES also has some weak keys. Nettle defines DES in @file
{
<nettle/des.h>
}
.
@deftp
{
Context struct
}
{
struct des
_
ctx
}
@end deftp
@defvr Constant DES
_
BLOCK
_
SIZE
The DES blocksize, 8
@end defvr
@defvr Constant DES
_
KEY
_
SIZE
DES key size, 8
@end defvr
@deftypefun int des
_
set
_
key (struct des
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
Initialize the cipher. The same function is used for both encryption and
decryption. Returns 1 on success, and 0 if the key was weak or had bad
parity. Calling @code
{
des
_
encrypt
}
or @code
{
des
_
decrypt
}
with a bad key
will crash with an assert violation.
@end deftypefun
@deftypefun void des
_
encrypt (struct des
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Encryption function. @var
{
length
}
must be an integral multiple of the
block size. If it is more than one block, the data is processed in ECB
mode. @code
{
src
}
and @code
{
dst
}
may be equal, but they must not overlap
in any other way.
@end deftypefun
@deftypefun void des
_
decrypt (struct des
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Analogous to @code
{
des
_
encrypt
}
@end deftypefun
@subsection SERPENT
SERPENT is one of the AES finalists, designed by Ross Anderson, Eli
Biham and Lars Knudsen. Thus, the interface and properties are similar
to AES'. One pecularity is that it is quite pointless to use it with
anything but the maximum key size, smaller keys are just padded to
larger ones. Nettle defines SERPENT in @file
{
<nettle/serpent.h>
}
.
@deftp
{
Context struct
}
{
struct serpent
_
ctx
}
@end deftp
@defvr Constant SERPENT
_
BLOCK
_
SIZE
The SERPENT blocksize, 16
@end defvr
@defvr Constant SERPENT
_
MIN
_
KEY
_
SIZE
Minumim SERPENT key size, 16
@end defvr
@defvr Constant SERPENT
_
MAX
_
KEY
_
SIZE
Maximum SERPENT key size, 32
@end defvr
@defvr Constant SERPENT
_
KEY
_
SIZE
Default SERPENT key size, 32
@end defvr
@deftypefun void serpent
_
set
_
key (struct serpent
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
Initialize the cipher. The same function is used for both encryption and
decryption.
@end deftypefun
@deftypefun void serpent
_
encrypt (struct serpent
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Encryption function. @var
{
length
}
must be an integral multiple of the
block size. If it is more than one block, the data is processed in ECB
mode. @code
{
src
}
and @code
{
dst
}
may be equal, but they must not overlap
in any other way.
@end deftypefun
@deftypefun void serpent
_
decrypt (struct serpent
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Analogous to @code
{
serpent
_
encrypt
}
@end deftypefun
@subsection TWOFISH
Another AES finalist, this one designed by Bruce Schneier and others.
Nettle defines it in @file
{
<nettle/twofish.h>
}
.
@deftp
{
Context struct
}
{
struct twofish
_
ctx
}
@end deftp
@defvr Constant TWOFISH
_
BLOCK
_
SIZE
The TWOFISH blocksize, 16
@end defvr
@defvr Constant TWOFISH
_
MIN
_
KEY
_
SIZE
Minumim TWOFISH key size, 16
@end defvr
@defvr Constant TWOFISH
_
MAX
_
KEY
_
SIZE
Maximum TWOFISH key size, 32
@end defvr
@defvr Constant TWOFISH
_
KEY
_
SIZE
Default TWOFISH key size, 32
@end defvr
@deftypefun void twofish
_
set
_
key (struct twofish
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
key
}
)
Initialize the cipher. The same function is used for both encryption and
decryption.
@end deftypefun
@deftypefun void twofish
_
encrypt (struct twofish
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Encryption function. @var
{
length
}
must be an integral multiple of the
block size. If it is more than one block, the data is processed in ECB
mode. @code
{
src
}
and @code
{
dst
}
may be equal, but they must not overlap
in any other way.
@end deftypefun
@deftypefun void twofish
_
decrypt (struct twofish
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
dst
}
, uint8
_
t *@var
{
src
}
)
Analogous to @code
{
twofish
_
encrypt
}
@end deftypefun
@node Miscellaneous functions, , Cipher functions, Reference
@comment node-name, next, previous, up
@section Miscellaneous functions
@deftypefun
{
uint8
_
t *
}
memxor (uint8
_
t *@var
{
dst
}
, const uint8
_
t *@var
{
src
}
, size
_
t @var
{
n
}
)
XOR:s the source area on top of the destination area. The interface
doesn't follow the Nettle conventions, because it is intended to be
similar to the ANSI-C @code
{
memcpy
}
function.
@end deftypefun
@node Installation, Index, Reference, Top
@comment node-name, next, previous, up
@chapter Installation
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment