~ubuntu-branches/ubuntu/saucy/clamav/saucy

« back to all changes in this revision

Viewing changes to shared/sha256.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2007-12-18 15:18:53 UTC
  • mfrom: (0.25.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071218151853-ag6bdjbq6budh353
Tags: 0.92~dfsg-0build1
Fake sync to get the new clamav into the NEW queue

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2001 Niels Moller
 
3
 *  
 
4
 * The nettle library is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; either version 2.1 of the License, or (at your
 
7
 * option) any later version.
 
8
 * 
 
9
 * The nettle library is distributed in the hope that it will be useful, but
 
10
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
11
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
12
 * License for more details.
 
13
 * 
 
14
 * You should have received a copy of the GNU Lesser General Public License
 
15
 * along with the nettle library; see the file COPYING.LIB.  If not, write to
 
16
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
17
 * MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
#ifndef __SHA256_H
 
21
#define __SHA256_H
 
22
 
 
23
#include "cltypes.h"
 
24
 
 
25
#define SHA256_DIGEST_SIZE 32
 
26
#define SHA256_DATA_SIZE 64
 
27
 
 
28
/* Digest is kept internally as 8 32-bit words. */
 
29
#define _SHA256_DIGEST_LENGTH 8
 
30
 
 
31
typedef struct sha256_ctx
 
32
{
 
33
  uint32_t state[_SHA256_DIGEST_LENGTH];    /* State variables */
 
34
  uint32_t count_low, count_high;           /* 64-bit block count */
 
35
  unsigned char block[SHA256_DATA_SIZE];          /* SHA256 data buffer */
 
36
  uint32_t index;                       /* index into buffer */
 
37
} SHA256_CTX;
 
38
 
 
39
void
 
40
sha256_init(struct sha256_ctx *ctx);
 
41
 
 
42
void
 
43
sha256_update(struct sha256_ctx *ctx, const unsigned char *data, uint32_t length);
 
44
 
 
45
void
 
46
sha256_final(struct sha256_ctx *ctx);
 
47
 
 
48
void
 
49
sha256_digest(const struct sha256_ctx *ctx, unsigned char *digest);
 
50
 
 
51
#endif