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
Nettle
nettle
Commits
7dfa2498
Commit
7dfa2498
authored
May 20, 2010
by
Niels Möller
Browse files
Added documentation for sha224 and sha384.
Rev: nettle/nettle.texinfo:1.10
parent
6f5fc6a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
nettle.texinfo
View file @
7dfa2498
...
...
@@ -170,14 +170,10 @@ Gutmann, and hacked some more by Andrew Kuchling and @value{AUTHOR}.
Released into the public domain. Assembler for x86 by @value
{
AUTHOR
}
,
released under the LGPL.
@item SHA2
56
@item SHA2
24, SHA256, SHA384, and SHA512
Written by @value
{
AUTHOR
}
, using Peter Gutmann's SHA1 code as a model.
Released under the LGPL.
@item SHA512
Written by @value
{
AUTHOR
}
, using Peter Gutmann's SHA1 and the above
SHA256 code as a model. Released under the LGPL.
@item TWOFISH
The implementation of the TWOFISH cipher is written by Ruud de Rooij.
Released under the LGPL.
...
...
@@ -511,17 +507,54 @@ This function also resets the context in the same way as
@code
{
sha256
_
init
}
.
@end deftypefun
@subsection @acronym
{
SHA
512
}
@subsection @acronym
{
SHA
224
}
SHA512 is a larger sibling to SHA256,
with a very similar similar but with both the output and the internal
variables of twice the size. The internal variables are 64 bits rather
than 32, making it significantly slower on 32-bit computers. It outputs
hash values of 512 bits, or 64 octets. Nettle defines SHA512 in
SHA224 is a variant of SHA256, with a different initial state, and with
the output truncated to 224 bits, or 28 octets. Nettle defines SHA224 in
@file
{
<nettle/sha.h>
}
.
The functions are analogous to the MD5 ones.
@deftp
{
Context struct
}
{
struct sha224
_
ctx
}
@end deftp
@defvr Constant SHA224
_
DIGEST
_
SIZE
The size of an SHA224 digest, i.e. 28.
@end defvr
@defvr Constant SHA224
_
DATA
_
SIZE
The internal block size of SHA224. Useful for some special constructions,
in particular HMAC-SHA224.
@end defvr
@deftypefun void sha224
_
init (struct sha224
_
ctx *@var
{
ctx
}
)
Initialize the SHA224 state.
@end deftypefun
@deftypefun void sha224
_
update (struct sha224
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
data
}
)
Hash some more data.
@end deftypefun
@deftypefun void sha224
_
digest (struct sha224
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, uint8
_
t *@var
{
digest
}
)
Performs final processing and extracts the message digest, writing it
to @var
{
digest
}
. @var
{
length
}
may be smaller than
@code
{
SHA224
_
DIGEST
_
SIZE
}
, in which case only the first @var
{
length
}
octets of the digest are written.
This function also resets the context in the same way as
@code
{
sha224
_
init
}
.
@end deftypefun
@subsection @acronym
{
SHA512
}
SHA512 is a larger sibling to SHA256, with a very similar structure but
with both the output and the internal variables of twice the size. The
internal variables are 64 bits rather than 32, making it significantly
slower on 32-bit computers. It outputs hash values of 512 bits, or 64
octets. Nettle defines SHA512 in @file
{
<nettle/sha.h>
}
.
The functions are analogous to the MD5 ones.
@deftp
{
Context struct
}
{
struct sha512
_
ctx
}
@end deftp
...
...
@@ -552,6 +585,44 @@ This function also resets the context in the same way as
@code
{
sha512
_
init
}
.
@end deftypefun
@subsection @acronym
{
SHA384
}
SHA384 is a variant of SHA512, with a different initial state, and with
the output truncated to 384 bits, or 48 octets. Nettle defines SHA384 in
@file
{
<nettle/sha.h>
}
.
The functions are analogous to the MD5 ones.
@deftp
{
Context struct
}
{
struct sha384
_
ctx
}
@end deftp
@defvr Constant SHA384
_
DIGEST
_
SIZE
The size of an SHA384 digest, i.e. 48.
@end defvr
@defvr Constant SHA384
_
DATA
_
SIZE
The internal block size of SHA384. Useful for some special constructions,
in particular HMAC-SHA384.
@end defvr
@deftypefun void sha384
_
init (struct sha384
_
ctx *@var
{
ctx
}
)
Initialize the SHA384 state.
@end deftypefun
@deftypefun void sha384
_
update (struct sha384
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, const uint8
_
t *@var
{
data
}
)
Hash some more data.
@end deftypefun
@deftypefun void sha384
_
digest (struct sha384
_
ctx *@var
{
ctx
}
, unsigned @var
{
length
}
, uint8
_
t *@var
{
digest
}
)
Performs final processing and extracts the message digest, writing it
to @var
{
digest
}
. @var
{
length
}
may be smaller than
@code
{
SHA384
_
DIGEST
_
SIZE
}
, in which case only the first @var
{
length
}
octets of the digest are written.
This function also resets the context in the same way as
@code
{
sha384
_
init
}
.
@end deftypefun
@subsection @code
{
struct nettle
_
hash
}
Nettle includes a struct including information about the supported hash
...
...
@@ -1761,7 +1832,11 @@ Before signing or verifying a message, you first hash it with the
appropriate hash function. You pass the hash function's context struct
to the @acronym
{
RSA
}
signature function, and it will extract the message
digest and do the rest of the work. There are also alternative functions
that take the @acronym
{
MD5
}
or @acronym
{
SHA1
}
hash digest as argument.
that take the hash digest as argument.
There is currently no support for using SHA224 or SHA384 with
@acronym
{
RSA
}
signatures, since there's no gain in either computation
time nor message size compared to using SHA256 and SHA512, respectively.
Creation and verification of signatures is done with the following functions:
...
...
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