gst_plugins_base/gst-libs/gst/cdda/sha1.h
branchRCL_3
changeset 30 7e817e7e631c
parent 2 5505e8908944
equal deleted inserted replaced
29:567bb019e3e3 30:7e817e7e631c
       
     1 /* NIST Secure Hash Algorithm */
       
     2 /* heavily modified by Uwe Hollerbach <uh@alumni.caltech edu> */
       
     3 /* from Peter C. Gutmann's implementation as found in */
       
     4 /* Applied Cryptography by Bruce Schneier */
       
     5 /* This code is in the public domain */
       
     6 /* $Id: sha1.h,v 1.2 2007-12-13 10:10:35 tpm Exp $ */
       
     7 
       
     8 #ifndef __GST_CDDA_SHA_H__
       
     9 #define __GST_CDDA_SHA_H__
       
    10 
       
    11 #include <stdlib.h>
       
    12 #include <stdio.h>
       
    13 
       
    14 /* Useful defines & typedefs */
       
    15 typedef unsigned char SHA_BYTE;	/* 8-bit quantity */
       
    16 typedef unsigned long SHA_LONG;	/* 32-or-more-bit quantity */
       
    17 
       
    18 #define SHA_BLOCKSIZE		64
       
    19 #define SHA_DIGESTSIZE		20
       
    20 
       
    21 typedef struct {
       
    22     SHA_LONG digest[5];		/* message digest */
       
    23     SHA_LONG count_lo, count_hi;	/* 64-bit bit count */
       
    24     SHA_BYTE data[SHA_BLOCKSIZE];	/* SHA data buffer */
       
    25     int local;			/* unprocessed amount in data */
       
    26 } SHA_INFO;
       
    27 
       
    28 #define sha_init   __gst_cdda_sha_init
       
    29 #define sha_update __gst_cdda_sha_update
       
    30 #define sha_final  __gst_cdda_sha_final
       
    31 
       
    32 void sha_init(SHA_INFO *);
       
    33 void sha_update(SHA_INFO *, SHA_BYTE *, int);
       
    34 void sha_final(unsigned char [20], SHA_INFO *);
       
    35 
       
    36 #define SHA_VERSION 1
       
    37 
       
    38 #ifdef HAVE_CONFIG_H 
       
    39 #include "config.h"
       
    40 
       
    41 
       
    42 #ifdef WORDS_BIGENDIAN
       
    43 #  if SIZEOF_LONG == 4
       
    44 #    define SHA_BYTE_ORDER  4321
       
    45 #  elif SIZEOF_LONG == 8
       
    46 #    define SHA_BYTE_ORDER  87654321
       
    47 #  endif
       
    48 #else
       
    49 #  if SIZEOF_LONG == 4
       
    50 #    define SHA_BYTE_ORDER  1234
       
    51 #  elif SIZEOF_LONG == 8
       
    52 #    define SHA_BYTE_ORDER  12345678
       
    53 #  endif
       
    54 #endif
       
    55 
       
    56 #else
       
    57 
       
    58 #define SHA_BYTE_ORDER 1234
       
    59 
       
    60 #endif
       
    61 
       
    62 #endif /* __GST_CDDA_SHA_H__ */