2001-09-21 04:16:11 +08:00
|
|
|
/*
|
2003-04-26 02:02:45 +08:00
|
|
|
* Copyright (c) 1997, 1998, 1999, 2000, 2002 Virtual Unlimited B.V.
|
2001-09-19 03:23:46 +08:00
|
|
|
*
|
|
|
|
* This library 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 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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 library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-04-29 16:15:16 +08:00
|
|
|
/*!\file sha1.h
|
|
|
|
* \brief SHA-1 hash function, headers.
|
|
|
|
* \author Bob Deblier <bob.deblier@pandora.be>
|
|
|
|
* \ingroup HASH_m HASH_sha1_m
|
|
|
|
*/
|
|
|
|
|
2002-06-15 04:31:05 +08:00
|
|
|
#ifndef _SHA1_H
|
|
|
|
#define _SHA1_H
|
2001-09-19 03:23:46 +08:00
|
|
|
|
|
|
|
#include "beecrypt.h"
|
|
|
|
|
2001-09-21 04:16:11 +08:00
|
|
|
/** \ingroup HASH_sha1_m
|
|
|
|
*/
|
2001-09-19 03:23:46 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2003-04-28 07:06:37 +08:00
|
|
|
uint32_t h[5];
|
|
|
|
uint32_t data[80];
|
|
|
|
#if (MP_WBITS == 64)
|
|
|
|
mpw length[1];
|
|
|
|
#elif (MP_WBITS == 32)
|
|
|
|
mpw length[2];
|
|
|
|
#else
|
|
|
|
# error
|
|
|
|
#endif
|
|
|
|
short offset;
|
2001-09-19 03:23:46 +08:00
|
|
|
} sha1Param;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2001-09-21 04:16:11 +08:00
|
|
|
/** \ingroup HASH_sha1_m
|
|
|
|
*/
|
2001-10-15 11:22:10 +08:00
|
|
|
/*@observer@*/ /*@checked@*/
|
2001-10-08 22:48:22 +08:00
|
|
|
extern BEECRYPTAPI const hashFunction sha1;
|
2001-09-19 03:23:46 +08:00
|
|
|
|
2001-09-21 04:16:11 +08:00
|
|
|
/** \ingroup HASH_sha1_m
|
|
|
|
*/
|
2001-10-08 22:48:22 +08:00
|
|
|
BEECRYPTAPI
|
2003-05-05 00:00:18 +08:00
|
|
|
void sha1Process(sha1Param* sp)
|
|
|
|
/*@modifies sp @*/;
|
2001-09-21 04:16:11 +08:00
|
|
|
|
|
|
|
/** \ingroup HASH_sha1_m
|
|
|
|
*/
|
2002-06-23 02:51:56 +08:00
|
|
|
BEECRYPTAPI /*@unused@*/
|
2003-05-05 00:00:18 +08:00
|
|
|
int sha1Reset (sha1Param* sp)
|
|
|
|
/*@modifies sp @*/;
|
2001-09-21 04:16:11 +08:00
|
|
|
|
|
|
|
/** \ingroup HASH_sha1_m
|
|
|
|
*/
|
2002-06-23 02:51:56 +08:00
|
|
|
BEECRYPTAPI /*@unused@*/
|
2003-05-05 00:00:18 +08:00
|
|
|
int sha1Update (sha1Param* sp, const byte* data, size_t size)
|
|
|
|
/*@modifies sp @*/;
|
2001-09-21 04:16:11 +08:00
|
|
|
|
|
|
|
/** \ingroup HASH_sha1_m
|
|
|
|
*/
|
2002-06-23 02:51:56 +08:00
|
|
|
BEECRYPTAPI /*@unused@*/
|
2003-05-05 00:00:18 +08:00
|
|
|
int sha1Digest (sha1Param* sp, /*@out@*/ byte* data)
|
|
|
|
/*@modifies sp, data @*/;
|
2001-09-19 03:23:46 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|