sph_haval.h File Reference
#include <stddef.h>
#include "sph_types.h"
Go to the source code of this file.
Data Structures |
struct | sph_haval_context |
Defines |
#define | SPH_SIZE_haval128_3 128 |
#define | SPH_SIZE_haval128_4 128 |
#define | SPH_SIZE_haval128_5 128 |
#define | SPH_SIZE_haval160_3 160 |
#define | SPH_SIZE_haval160_4 160 |
#define | SPH_SIZE_haval160_5 160 |
#define | SPH_SIZE_haval192_3 192 |
#define | SPH_SIZE_haval192_4 192 |
#define | SPH_SIZE_haval192_5 192 |
#define | SPH_SIZE_haval224_3 224 |
#define | SPH_SIZE_haval224_4 224 |
#define | SPH_SIZE_haval224_5 224 |
#define | SPH_SIZE_haval256_3 256 |
#define | SPH_SIZE_haval256_4 256 |
#define | SPH_SIZE_haval256_5 256 |
Typedefs |
typedef sph_haval_context | sph_haval128_3_context |
typedef sph_haval_context | sph_haval128_4_context |
typedef sph_haval_context | sph_haval128_5_context |
typedef sph_haval_context | sph_haval160_3_context |
typedef sph_haval_context | sph_haval160_4_context |
typedef sph_haval_context | sph_haval160_5_context |
typedef sph_haval_context | sph_haval192_3_context |
typedef sph_haval_context | sph_haval192_4_context |
typedef sph_haval_context | sph_haval192_5_context |
typedef sph_haval_context | sph_haval224_3_context |
typedef sph_haval_context | sph_haval224_4_context |
typedef sph_haval_context | sph_haval224_5_context |
typedef sph_haval_context | sph_haval256_3_context |
typedef sph_haval_context | sph_haval256_4_context |
typedef sph_haval_context | sph_haval256_5_context |
Functions |
void | sph_haval128_3_init (void *cc) |
void | sph_haval128_3 (void *cc, const void *data, size_t len) |
void | sph_haval128_3_close (void *cc, void *dst) |
void | sph_haval128_3_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval128_4_init (void *cc) |
void | sph_haval128_4 (void *cc, const void *data, size_t len) |
void | sph_haval128_4_close (void *cc, void *dst) |
void | sph_haval128_4_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval128_5_init (void *cc) |
void | sph_haval128_5 (void *cc, const void *data, size_t len) |
void | sph_haval128_5_close (void *cc, void *dst) |
void | sph_haval128_5_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval160_3_init (void *cc) |
void | sph_haval160_3 (void *cc, const void *data, size_t len) |
void | sph_haval160_3_close (void *cc, void *dst) |
void | sph_haval160_3_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval160_4_init (void *cc) |
void | sph_haval160_4 (void *cc, const void *data, size_t len) |
void | sph_haval160_4_close (void *cc, void *dst) |
void | sph_haval160_5_init (void *cc) |
void | sph_haval160_5 (void *cc, const void *data, size_t len) |
void | sph_haval160_5_close (void *cc, void *dst) |
void | sph_haval160_5_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval192_3_init (void *cc) |
void | sph_haval192_3 (void *cc, const void *data, size_t len) |
void | sph_haval192_3_close (void *cc, void *dst) |
void | sph_haval192_3_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval192_4_init (void *cc) |
void | sph_haval192_4 (void *cc, const void *data, size_t len) |
void | sph_haval192_4_close (void *cc, void *dst) |
void | sph_haval192_4_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval192_5_init (void *cc) |
void | sph_haval192_5 (void *cc, const void *data, size_t len) |
void | sph_haval192_5_close (void *cc, void *dst) |
void | sph_haval192_5_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval224_3_init (void *cc) |
void | sph_haval224_3 (void *cc, const void *data, size_t len) |
void | sph_haval224_3_close (void *cc, void *dst) |
void | sph_haval224_3_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval224_4_init (void *cc) |
void | sph_haval224_4 (void *cc, const void *data, size_t len) |
void | sph_haval224_4_close (void *cc, void *dst) |
void | sph_haval224_4_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval224_5_init (void *cc) |
void | sph_haval224_5 (void *cc, const void *data, size_t len) |
void | sph_haval224_5_close (void *cc, void *dst) |
void | sph_haval224_5_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval256_3_init (void *cc) |
void | sph_haval256_3 (void *cc, const void *data, size_t len) |
void | sph_haval256_3_close (void *cc, void *dst) |
void | sph_haval256_3_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval256_4_init (void *cc) |
void | sph_haval256_4 (void *cc, const void *data, size_t len) |
void | sph_haval256_4_close (void *cc, void *dst) |
void | sph_haval256_4_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval256_5_init (void *cc) |
void | sph_haval256_5 (void *cc, const void *data, size_t len) |
void | sph_haval256_5_close (void *cc, void *dst) |
void | sph_haval256_5_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst) |
void | sph_haval_3_comp (const sph_u32 msg[32], sph_u32 val[8]) |
void | sph_haval_4_comp (const sph_u32 msg[32], sph_u32 val[8]) |
void | sph_haval_5_comp (const sph_u32 msg[32], sph_u32 val[8]) |
Detailed Description
HAVAL interface.
HAVAL is actually a family of 15 hash functions, depending on whether the internal computation uses 3, 4 or 5 passes, and on the output length, which is 128, 160, 192, 224 or 256 bits. This implementation provides interface functions for all 15, which internally map to three cores (depending on the number of passes). Note that output lengths other than 256 bits are not obtained by a simple truncation of a longer result; the requested length is encoded within the padding data.
HAVAL was published in: Yuliang Zheng, Josef Pieprzyk and Jennifer Seberry: "HAVAL -- a one-way hashing algorithm with variable length
of output", Advances in Cryptology -- AUSCRYPT'92, Lecture Notes in Computer Science, Vol.718, pp.83-104, Springer-Verlag, 1993.
This paper, and a reference implementation, are available on the Calyptix web site: http://labs.calyptix.com/haval.php
The HAVAL reference paper is quite unclear on the data encoding details, i.e. endianness (both byte order within a 32-bit word, and word order within a message block). This implementation has been made compatible with the reference implementation referenced above.
- Warning:
- A collision for HAVAL-128/3 (HAVAL with three passes and 128-bit output) has been published; this function is thus considered as cryptographically broken. The status for other variants is unclear; use only with care.
==========================(LICENSE BEGIN)============================
Copyright (c) 2007-2010 Projet RNRT SAPHIR
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
===========================(LICENSE END)=============================
- Author:
- Thomas Pornin <thomas.pornin@cryptolog.com>
Define Documentation
#define SPH_SIZE_haval128_3 128 |
Output size (in bits) for HAVAL-128/3.
#define SPH_SIZE_haval128_4 128 |
Output size (in bits) for HAVAL-128/4.
#define SPH_SIZE_haval128_5 128 |
Output size (in bits) for HAVAL-128/5.
#define SPH_SIZE_haval160_3 160 |
Output size (in bits) for HAVAL-160/3.
#define SPH_SIZE_haval160_4 160 |
Output size (in bits) for HAVAL-160/4.
#define SPH_SIZE_haval160_5 160 |
Output size (in bits) for HAVAL-160/5.
#define SPH_SIZE_haval192_3 192 |
Output size (in bits) for HAVAL-192/3.
#define SPH_SIZE_haval192_4 192 |
Output size (in bits) for HAVAL-192/4.
#define SPH_SIZE_haval192_5 192 |
Output size (in bits) for HAVAL-192/5.
#define SPH_SIZE_haval224_3 224 |
Output size (in bits) for HAVAL-224/3.
#define SPH_SIZE_haval224_4 224 |
Output size (in bits) for HAVAL-224/4.
#define SPH_SIZE_haval224_5 224 |
Output size (in bits) for HAVAL-224/5.
#define SPH_SIZE_haval256_3 256 |
Output size (in bits) for HAVAL-256/3.
#define SPH_SIZE_haval256_4 256 |
Output size (in bits) for HAVAL-256/4.
#define SPH_SIZE_haval256_5 256 |
Output size (in bits) for HAVAL-256/5.
Typedef Documentation
Type for a HAVAL-128/3 context (identical to the common context).
Type for a HAVAL-128/4 context (identical to the common context).
Type for a HAVAL-128/5 context (identical to the common context).
Type for a HAVAL-160/3 context (identical to the common context).
Type for a HAVAL-160/4 context (identical to the common context).
Type for a HAVAL-160/5 context (identical to the common context).
Type for a HAVAL-192/3 context (identical to the common context).
Type for a HAVAL-192/4 context (identical to the common context).
Type for a HAVAL-192/5 context (identical to the common context).
Type for a HAVAL-224/3 context (identical to the common context).
Type for a HAVAL-224/4 context (identical to the common context).
Type for a HAVAL-224/5 context (identical to the common context).
Type for a HAVAL-256/3 context (identical to the common context).
Type for a HAVAL-256/4 context (identical to the common context).
Type for a HAVAL-256/5 context (identical to the common context).
Function Documentation
void sph_haval128_3_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-128/3.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval128_3_context structure) |
void sph_haval128_3 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-128/3. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-128/3 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval128_3_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-128/3 computation. The output buffer must be wide enough to accomodate the result (16 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-128/3 context |
| dst | the output buffer |
void sph_haval128_3_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-128/3 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (16 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-128/3 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval128_4_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-128/4.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval128_4_context structure) |
void sph_haval128_4 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-128/4. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-128/4 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval128_4_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-128/4 computation. The output buffer must be wide enough to accomodate the result (16 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-128/4 context |
| dst | the output buffer |
void sph_haval128_4_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-128/4 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (16 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-128/4 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval128_5_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-128/5.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval128_5_context structure) |
void sph_haval128_5 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-128/5. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-128/5 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval128_5_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-128/5 computation. The output buffer must be wide enough to accomodate the result (16 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-128/5 context |
| dst | the output buffer |
void sph_haval128_5_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-128/5 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (16 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-128/5 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval160_3_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-160/3.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval160_3_context structure) |
void sph_haval160_3 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-160/3. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-160/3 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval160_3_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-160/3 computation. The output buffer must be wide enough to accomodate the result (20 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-160/3 context |
| dst | the output buffer |
void sph_haval160_3_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-160/3 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (20 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-160/3 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
Close a HAVAL-160/4 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (20 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-160/4 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval160_4_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-160/4.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval160_4_context structure) |
void sph_haval160_4 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-160/4. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-160/4 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval160_4_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-160/4 computation. The output buffer must be wide enough to accomodate the result (20 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-160/4 context |
| dst | the output buffer |
void sph_haval160_5_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-160/5.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval160_5_context structure) |
void sph_haval160_5 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-160/5. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-160/5 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval160_5_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-160/5 computation. The output buffer must be wide enough to accomodate the result (20 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-160/5 context |
| dst | the output buffer |
void sph_haval160_5_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-160/5 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (20 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-160/5 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval192_3_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-192/3.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval192_3_context structure) |
void sph_haval192_3 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-192/3. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-192/3 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval192_3_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-192/3 computation. The output buffer must be wide enough to accomodate the result (24 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-192/3 context |
| dst | the output buffer |
void sph_haval192_3_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-192/3 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (24 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-192/3 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval192_4_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-192/4.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval192_4_context structure) |
void sph_haval192_4 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-192/4. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-192/4 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval192_4_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-192/4 computation. The output buffer must be wide enough to accomodate the result (24 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-192/4 context |
| dst | the output buffer |
void sph_haval192_4_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-192/4 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (24 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-192/4 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval192_5_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-192/5.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval192_5_context structure) |
void sph_haval192_5 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-192/5. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-192/5 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval192_5_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-192/5 computation. The output buffer must be wide enough to accomodate the result (24 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-192/5 context |
| dst | the output buffer |
void sph_haval192_5_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-192/5 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (24 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-192/5 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval224_3_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-224/3.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval224_3_context structure) |
void sph_haval224_3 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-224/3. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-224/3 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval224_3_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-224/3 computation. The output buffer must be wide enough to accomodate the result (28 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-224/3 context |
| dst | the output buffer |
void sph_haval224_3_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-224/3 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (28 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-224/3 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval224_4_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-224/4.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval224_4_context structure) |
void sph_haval224_4 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-224/4. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-224/4 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval224_4_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-224/4 computation. The output buffer must be wide enough to accomodate the result (28 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-224/4 context |
| dst | the output buffer |
void sph_haval224_4_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-224/4 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (28 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-224/4 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval224_5_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-224/5.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval224_5_context structure) |
void sph_haval224_5 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-224/5. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-224/5 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval224_5_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-224/5 computation. The output buffer must be wide enough to accomodate the result (28 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-224/5 context |
| dst | the output buffer |
void sph_haval224_5_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-224/5 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (28 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-224/5 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval256_3_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-256/3.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval256_3_context structure) |
void sph_haval256_3 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-256/3. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-256/3 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval256_3_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-256/3 computation. The output buffer must be wide enough to accomodate the result (32 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-256/3 context |
| dst | the output buffer |
void sph_haval256_3_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-256/3 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (32 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-256/3 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval256_4_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-256/4.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval256_4_context structure) |
void sph_haval256_4 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-256/4. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-256/4 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval256_4_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-256/4 computation. The output buffer must be wide enough to accomodate the result (32 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-256/4 context |
| dst | the output buffer |
void sph_haval256_4_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-256/4 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (32 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-256/4 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
void sph_haval256_5_init |
( |
void * |
cc |
) |
|
Initialize the context for HAVAL-256/5.
- Parameters:
-
| cc | context to initialize (pointer to a sph_haval256_5_context structure) |
void sph_haval256_5 |
( |
void * |
cc, |
|
|
const void * |
data, |
|
|
size_t |
len | |
|
) |
| | |
Process some data bytes for HAVAL-256/5. If len
is 0, then this function does nothing.
- Parameters:
-
| cc | the HAVAL-256/5 context |
| data | the input data |
| len | the input data length (in bytes) |
void sph_haval256_5_close |
( |
void * |
cc, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-256/5 computation. The output buffer must be wide enough to accomodate the result (32 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-256/5 context |
| dst | the output buffer |
void sph_haval256_5_addbits_and_close |
( |
void * |
cc, |
|
|
unsigned |
ub, |
|
|
unsigned |
n, |
|
|
void * |
dst | |
|
) |
| | |
Close a HAVAL-256/5 computation. Up to 7 extra input bits may be added to the input message; these are the n
upper bits of the ub
byte (i.e. the first extra bit has value 128 in ub
, the second extra bit has value 64, and so on). Other bits in ub
are ignored.
The output buffer must be wide enough to accomodate the result (32 bytes). The context is automatically reinitialized.
- Parameters:
-
| cc | the HAVAL-256/5 context |
| ub | the extra bits |
| n | the number of extra bits (0 to 7) |
| dst | the output buffer |
Apply the HAVAL compression function on the provided data. The msg
parameter contains the 32 32-bit input blocks, as numerical values (hence after the little-endian decoding). The val
parameter contains the 8 32-bit input blocks for the compression function; the output is written in place in this array. This function uses three internal passes.
- Parameters:
-
| msg | the message block (32 values) |
| val | the function 256-bit input and output |
Apply the HAVAL compression function on the provided data. The msg
parameter contains the 32 32-bit input blocks, as numerical values (hence after the little-endian decoding). The val
parameter contains the 8 32-bit input blocks for the compression function; the output is written in place in this array. This function uses four internal passes.
- Parameters:
-
| msg | the message block (32 values) |
| val | the function 256-bit input and output |
Apply the HAVAL compression function on the provided data. The msg
parameter contains the 32 32-bit input blocks, as numerical values (hence after the little-endian decoding). The val
parameter contains the 8 32-bit input blocks for the compression function; the output is written in place in this array. This function uses five internal passes.
- Parameters:
-
| msg | the message block (32 values) |
| val | the function 256-bit input and output |