gst_plugins_base/gst-libs/gst/cdda/sha1.h
changeset 0 0e761a78d257
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 /* NIST Secure Hash Algorithm */
       
    18 /* heavily modified by Uwe Hollerbach <uh@alumni.caltech edu> */
       
    19 /* from Peter C. Gutmann's implementation as found in */
       
    20 /* Applied Cryptography by Bruce Schneier */
       
    21 /* This code is in the public domain */
       
    22 /* $Id: sha1.h,v 1.2 2007-12-13 10:10:35 tpm Exp $ */
       
    23 
       
    24 #ifndef __GST_CDDA_SHA_H__
       
    25 #define __GST_CDDA_SHA_H__
       
    26 
       
    27 #include <stdlib.h>
       
    28 #include <stdio.h>
       
    29 
       
    30 /* Useful defines & typedefs */
       
    31 typedef unsigned char SHA_BYTE;	/* 8-bit quantity */
       
    32 typedef unsigned long SHA_LONG;	/* 32-or-more-bit quantity */
       
    33 
       
    34 #define SHA_BLOCKSIZE		64
       
    35 #define SHA_DIGESTSIZE		20
       
    36 
       
    37 typedef struct {
       
    38     SHA_LONG digest[5];		/* message digest */
       
    39     SHA_LONG count_lo, count_hi;	/* 64-bit bit count */
       
    40     SHA_BYTE data[SHA_BLOCKSIZE];	/* SHA data buffer */
       
    41     int local;			/* unprocessed amount in data */
       
    42 } SHA_INFO;
       
    43 
       
    44 #define sha_init   __gst_cdda_sha_init
       
    45 #define sha_update __gst_cdda_sha_update
       
    46 #define sha_final  __gst_cdda_sha_final
       
    47 
       
    48 void sha_init(SHA_INFO *);
       
    49 void sha_update(SHA_INFO *, SHA_BYTE *, int);
       
    50 void sha_final(unsigned char [20], SHA_INFO *);
       
    51 
       
    52 #define SHA_VERSION 1
       
    53 
       
    54 #ifdef HAVE_CONFIG_H 
       
    55 #include "config.h"
       
    56 
       
    57 
       
    58 #ifdef WORDS_BIGENDIAN
       
    59 #  if SIZEOF_LONG == 4
       
    60 #    define SHA_BYTE_ORDER  4321
       
    61 #  elif SIZEOF_LONG == 8
       
    62 #    define SHA_BYTE_ORDER  87654321
       
    63 #  endif
       
    64 #else
       
    65 #  if SIZEOF_LONG == 4
       
    66 #    define SHA_BYTE_ORDER  1234
       
    67 #  elif SIZEOF_LONG == 8
       
    68 #    define SHA_BYTE_ORDER  12345678
       
    69 #  endif
       
    70 #endif
       
    71 
       
    72 #else
       
    73 
       
    74 #define SHA_BYTE_ORDER 1234
       
    75 
       
    76 #endif
       
    77 
       
    78 #endif /* __GST_CDDA_SHA_H__ */