aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sha1.h
blob: 4ef8ac9219c421f474130c2447d21729052f8507 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * SHA1 hashing code copied from Lepton's crack <http://usuarios.lycos.es/reinob/>
 *
 * Adapted to be API-compatible with the previous (GPL-incompatible) code.
 */

/*
 *  sha1.h
 *
 *  Description:
 *      This is the header file for code which implements the Secure
 *      Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
 *      April 17, 1995.
 *
 *      Many of the variable names in this code, especially the
 *      single character names, were used because those were the names
 *      used in the publication.
 *
 *      Please read the file sha1.c for more information.
 *
 */

#ifndef _SHA1_H_
#define _SHA1_H_

#if(__sun)
#include <inttypes.h>
#else
#include <stdint.h>
#endif
#include <gmodule.h>

#ifndef _SHA_enum_
#define _SHA_enum_
enum {
	shaSuccess = 0,
	shaNull,		/* Null pointer parameter */
	shaInputTooLong,	/* input data too long */
	shaStateError		/* called Input after Result */
};
#endif
#define sha1_hash_size 20

/*
 *  This structure will hold context information for the SHA-1
 *  hashing operation
 */
typedef struct SHA1Context {
	uint32_t Intermediate_Hash[sha1_hash_size/4];	/* Message Digest   */

	uint32_t Length_Low;            /* Message length in bits           */
	uint32_t Length_High;           /* Message length in bits           */

	/* Index into message block array   */
	int_least16_t Message_Block_Index;
	uint8_t Message_Block[64];	/* 512-bit message blocks           */

	int Computed;                   /* Is the digest computed?          */
	int Corrupted;                  /* Is the message digest corrupted? */
} sha1_state_t;

/*
 *  Function Prototypes
 */

G_MODULE_EXPORT int sha1_init(sha1_state_t *);
G_MODULE_EXPORT int sha1_append(sha1_state_t *, const uint8_t *, unsigned int);
G_MODULE_EXPORT int sha1_finish(sha1_state_t *, uint8_t Message_Digest[sha1_hash_size]);

#endif
ate> <xsl:template match="ircexample"> <xsl:element name="screen"> <xsl:for-each select="ircline|ircaction"> <xsl:apply-templates select="."/> </xsl:for-each> </xsl:element> </xsl:template> <!-- This is needed to copy content unchanged --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template name="subcmd-list"> <xsl:if test="bitlbee-command != ''"> <xsl:element name="variablelist"> <xsl:for-each select="bitlbee-command"> <xsl:element name="varlistentry"> <xsl:element name="term"> <xsl:value-of select="@name"/> </xsl:element> <xsl:element name="listitem"> <xsl:element name="para"> <xsl:value-of select="short-description"/> </xsl:element> </xsl:element> </xsl:element> </xsl:for-each> </xsl:element> </xsl:if> </xsl:template> <xsl:template match="command-list"> <xsl:call-template name="subcmd-list"/> </xsl:template> <xsl:template match="bitlbee-setting"> <xsl:element name="sect1"> <xsl:attribute name="id"> <xsl:text>set_</xsl:text> <xsl:value-of select="@name"/> </xsl:attribute> <xsl:element name="title"><xsl:value-of select="@name"/></xsl:element> <xsl:element name="simplelist"> <xsl:element name="member"> <xsl:text>Type: </xsl:text><xsl:value-of select="@type"/> </xsl:element> </xsl:element> <xsl:for-each select="description/para"> <xsl:apply-templates select="."/> </xsl:for-each> </xsl:element> </xsl:template> <xsl:template name="cmd"> <xsl:param name="prefix"/> <xsl:variable name="thiscmd"><xsl:value-of select="$prefix"/><xsl:value-of select="@name"/></xsl:variable> <xsl:attribute name="id"> <xsl:text>cmd_</xsl:text> <xsl:value-of select="translate($thiscmd,' ','_')"/> </xsl:attribute> <xsl:element name="title"><xsl:value-of select="$thiscmd"/> <xsl:if test="short-description"> <xsl:text> - </xsl:text> <xsl:value-of select="short-description"/> </xsl:if> </xsl:element> <xsl:element name="formalpara"> <xsl:element name="title"><xsl:text>Syntax:</xsl:text></xsl:element> <xsl:element name="para"> <xsl:element name="programlisting"> <xsl:for-each select="syntax"> <xsl:value-of select="normalize-space(.)"/><xsl:text>&#10;</xsl:text> </xsl:for-each> </xsl:element> </xsl:element> </xsl:element> <xsl:for-each select="description/para"> <xsl:apply-templates select="."/> </xsl:for-each> <xsl:for-each select="ircexample"> <xsl:apply-templates select="."/> </xsl:for-each> <!--<xsl:call-template name="subcmd-list"/>--> <xsl:for-each select="bitlbee-command"> <xsl:element name="sect2"> <xsl:call-template name="cmd"> <xsl:with-param name="prefix"><xsl:value-of select="$thiscmd"/><xsl:text> </xsl:text> </xsl:with-param> </xsl:call-template> </xsl:element> </xsl:for-each> </xsl:template> <xsl:template match="bitlbee-command"> <xsl:element name="sect1"> <xsl:call-template name="cmd"> <xsl:with-param name="prefix" select="''"/> </xsl:call-template> </xsl:element> </xsl:template> </xsl:stylesheet>