91 lines
2.9 KiB
C
91 lines
2.9 KiB
C
/*
|
|
* This file is a part of Pcompress, a chunked parallel multi-
|
|
* algorithm lossless compression and decompression program.
|
|
*
|
|
* Copyright (C) 2012-2013 Moinak Ghosh. All rights reserved.
|
|
* Use is subject to license terms.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 3 of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this program.
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* moinakg@belenix.org, http://moinakg.wordpress.com/
|
|
*
|
|
*/
|
|
|
|
#ifndef _AHS_API_H_
|
|
#define _AHS_API_H_
|
|
|
|
/***********************************************************************
|
|
**
|
|
** Interface declarations of the AHS API using the Skein hash function.
|
|
**
|
|
** Source code author: Doug Whiting, 2008.
|
|
**
|
|
** This algorithm and source code is released to the public domain.
|
|
**
|
|
************************************************************************/
|
|
|
|
#include "skein.h"
|
|
|
|
typedef enum
|
|
{
|
|
SUCCESS = SKEIN_SUCCESS,
|
|
FAIL = SKEIN_FAIL,
|
|
BAD_HASHLEN = SKEIN_BAD_HASHLEN
|
|
}
|
|
HashReturn;
|
|
|
|
typedef size_t DataLength; /* bit count type */
|
|
typedef u08b_t BitSequence; /* bit stream type */
|
|
|
|
typedef struct
|
|
{
|
|
uint_t statebits; /* 256, 512, or 1024 */
|
|
union
|
|
{
|
|
Skein_Ctxt_Hdr_t h; /* common header "overlay" */
|
|
Skein_256_Ctxt_t ctx_256;
|
|
Skein_512_Ctxt_t ctx_512;
|
|
Skein1024_Ctxt_t ctx1024;
|
|
} u;
|
|
}
|
|
hashState;
|
|
|
|
/* "incremental" hashing API */
|
|
HashReturn Init (hashState *state, int hashbitlen);
|
|
HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen);
|
|
HashReturn Final (hashState *state, BitSequence *hashval);
|
|
|
|
/* "all-in-one" call */
|
|
HashReturn Hash (int hashbitlen, const BitSequence *data,
|
|
DataLength databitlen, BitSequence *hashval);
|
|
|
|
|
|
/*
|
|
** Re-define the compile-time constants below to change the selection
|
|
** of the Skein state size in the Init() function in SHA3api_ref.c.
|
|
**
|
|
** That is, the NIST API does not allow for explicit selection of the
|
|
** Skein block size, so it must be done implicitly in the Init() function.
|
|
** The selection is controlled by these constants.
|
|
*/
|
|
#ifndef SKEIN_256_NIST_MAX_HASHBITS
|
|
#define SKEIN_256_NIST_MAX_HASHBITS (0)
|
|
#endif
|
|
|
|
#ifndef SKEIN_512_NIST_MAX_HASHBITS
|
|
#define SKEIN_512_NIST_MAX_HASHBITS (512)
|
|
#endif
|
|
|
|
#endif /* ifdef _AHS_API_H_ */
|