diff options
author | Bastien Nocera <hadess@users.sourceforge.net> | 2004-05-05 09:11:38 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@users.sourceforge.net> | 2004-05-05 09:11:38 +0000 |
commit | eb5fedbbd6adfbb7a4e91e53bc70b5f48592c10f (patch) | |
tree | 0890cd11d2c14615c9854815b2e4f4b8103010ef /src/input/sha1.h | |
parent | a3f734fddfc6c2b277a44cc82452d09aaf5e638d (diff) | |
download | xine-lib-eb5fedbbd6adfbb7a4e91e53bc70b5f48592c10f.tar.gz xine-lib-eb5fedbbd6adfbb7a4e91e53bc70b5f48592c10f.tar.bz2 |
make it possible for the CDDA plugin to give away Musicbrainz CD Index ID
base64.[ch] are now relicensed under the GNU General Public License as per
section 3 of the GNU Less General Public License
sha1.[ch] are still under a public domain license, see headers for details
CVS patchset: 6485
CVS date: 2004/05/05 09:11:38
Diffstat (limited to 'src/input/sha1.h')
-rw-r--r-- | src/input/sha1.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/input/sha1.h b/src/input/sha1.h new file mode 100644 index 000000000..6657c92e3 --- /dev/null +++ b/src/input/sha1.h @@ -0,0 +1,61 @@ +/* NIST Secure Hash Algorithm */ +/* heavily modified by Uwe Hollerbach <uh@alumni.caltech edu> */ +/* from Peter C. Gutmann's implementation as found in */ +/* Applied Cryptography by Bruce Schneier */ +/* This code is in the public domain */ +/* $Id: sha1.h,v 1.1 2004/05/05 09:11:39 hadess Exp $ */ + +#ifndef SHA_H +#define SHA_H + +#include <stdlib.h> +#include <stdio.h> + +/* Useful defines & typedefs */ +typedef unsigned char SHA_BYTE; /* 8-bit quantity */ +typedef unsigned long SHA_LONG; /* 32-or-more-bit quantity */ + +#define SHA_BLOCKSIZE 64 +#define SHA_DIGESTSIZE 20 + +typedef struct { + SHA_LONG digest[5]; /* message digest */ + SHA_LONG count_lo, count_hi; /* 64-bit bit count */ + SHA_BYTE data[SHA_BLOCKSIZE]; /* SHA data buffer */ + int local; /* unprocessed amount in data */ +} SHA_INFO; + +void sha_init(SHA_INFO *); +void sha_update(SHA_INFO *, SHA_BYTE *, int); +void sha_final(unsigned char [20], SHA_INFO *); + +void sha_stream(unsigned char [20], SHA_INFO *, FILE *); +void sha_print(unsigned char [20]); +char *sha_version(void); + +#define SHA_VERSION 1 + +#ifdef HAVE_CONFIG_H +#include "config.h" + +#ifdef WORDS_BIGENDIAN +# if SIZEOF_LONG == 4 +# define SHA_BYTE_ORDER 4321 +# elif SIZEOF_LONG == 8 +# define SHA_BYTE_ORDER 87654321 +# endif +#else +# if SIZEOF_LONG == 4 +# define SHA_BYTE_ORDER 1234 +# elif SIZEOF_LONG == 8 +# define SHA_BYTE_ORDER 12345678 +# endif +#endif + +#else + +#define SHA_BYTE_ORDER 1234 + +#endif + +#endif /* SHA_H */ |