Changeset 5284:3fcf039ca02c in roaraudio for include


Ignore:
Timestamp:
11/22/11 12:53:18 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

ported hash API to < 32 bit archs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/hash.h

    r4878 r5284  
    3939#include "libroar.h" 
    4040 
     41typedef uint_least32_t roar_hash_t; 
     42 
    4143// the hashtypes: 
    42 #define ROAR_HT_NONE        0 
    43 #define ROAR_HT_MD5         1 
    44 #define ROAR_HT_SHA1        2 
    45 #define ROAR_HT_RIPEMD160   3 
    46 #define ROAR_HT_MD2         5 
    47 #define ROAR_HT_TIGER       6 
    48 #define ROAR_HT_HAVAL       7 
    49 #define ROAR_HT_SHA256      8 
    50 #define ROAR_HT_SHA384      9 
    51 #define ROAR_HT_SHA512      10 
    52 #define ROAR_HT_SHA224      11 
    53 #define ROAR_HT_MD4         301 
    54 #define ROAR_HT_CRC32       302 
    55 #define ROAR_HT_RFC1510     303 
    56 #define ROAR_HT_RFC2440     304 
    57 #define ROAR_HT_WHIRLPOOL   305 
    58 #define ROAR_HT_UUID        70000 
    59 #define ROAR_HT_GTN8        70001 
    60 #define ROAR_HT_GTN16       70002 
    61 #define ROAR_HT_GTN32       70004 
    62 #define ROAR_HT_GTN64       70008 
    63 #define ROAR_HT_CLIENTID    71001 
    64 #define ROAR_HT_STREAMID    71002 
    65 #define ROAR_HT_SOURCEID    71003 
    66 #define ROAR_HT_SAMPLEID    71004 
    67 #define ROAR_HT_MIXERID     71005 
    68 #define ROAR_HT_BRIDGEID    71006 
    69 #define ROAR_HT_LISTENID    71007 
    70 #define ROAR_HT_ACTIONID    71008 
    71 #define ROAR_HT_MSGQUEUEID  71009 
    72 #define ROAR_HT_MSGBUSID    71010 
    73 #define ROAR_HT_GTIN8       72001 
    74 #define ROAR_HT_GTIN13      72002 
    75 #define ROAR_HT_ISBN10      72003 
     44#define ROAR_HT_NONE        ((roar_hash_t)0UL) 
     45#define ROAR_HT_MD5         ((roar_hash_t)1UL) 
     46#define ROAR_HT_SHA1        ((roar_hash_t)2UL) 
     47#define ROAR_HT_RIPEMD160   ((roar_hash_t)3UL) 
     48#define ROAR_HT_MD2         ((roar_hash_t)5UL) 
     49#define ROAR_HT_TIGER       ((roar_hash_t)6UL) 
     50#define ROAR_HT_HAVAL       ((roar_hash_t)7UL) 
     51#define ROAR_HT_SHA256      ((roar_hash_t)8UL) 
     52#define ROAR_HT_SHA384      ((roar_hash_t)9UL) 
     53#define ROAR_HT_SHA512      ((roar_hash_t)10UL) 
     54#define ROAR_HT_SHA224      ((roar_hash_t)11UL) 
     55#define ROAR_HT_MD4         ((roar_hash_t)301UL) 
     56#define ROAR_HT_CRC32       ((roar_hash_t)302UL) 
     57#define ROAR_HT_RFC1510     ((roar_hash_t)303UL) 
     58#define ROAR_HT_RFC2440     ((roar_hash_t)304UL) 
     59#define ROAR_HT_WHIRLPOOL   ((roar_hash_t)305UL) 
     60#define ROAR_HT_UUID        ((roar_hash_t)70000UL) 
     61#define ROAR_HT_GTN8        ((roar_hash_t)70001UL) 
     62#define ROAR_HT_GTN16       ((roar_hash_t)70002UL) 
     63#define ROAR_HT_GTN32       ((roar_hash_t)70004UL) 
     64#define ROAR_HT_GTN64       ((roar_hash_t)70008UL) 
     65#define ROAR_HT_CLIENTID    ((roar_hash_t)71001UL) 
     66#define ROAR_HT_STREAMID    ((roar_hash_t)71002UL) 
     67#define ROAR_HT_SOURCEID    ((roar_hash_t)71003UL) 
     68#define ROAR_HT_SAMPLEID    ((roar_hash_t)71004UL) 
     69#define ROAR_HT_MIXERID     ((roar_hash_t)71005UL) 
     70#define ROAR_HT_BRIDGEID    ((roar_hash_t)71006UL) 
     71#define ROAR_HT_LISTENID    ((roar_hash_t)71007UL) 
     72#define ROAR_HT_ACTIONID    ((roar_hash_t)71008UL) 
     73#define ROAR_HT_MSGQUEUEID  ((roar_hash_t)71009UL) 
     74#define ROAR_HT_MSGBUSID    ((roar_hash_t)71010UL) 
     75#define ROAR_HT_GTIN8       ((roar_hash_t)72001UL) 
     76#define ROAR_HT_GTIN13      ((roar_hash_t)72002UL) 
     77#define ROAR_HT_ISBN10      ((roar_hash_t)72003UL) 
    7678#define ROAR_HT_ISBN13      ROAR_HT_GTIN13 
    77 #define ROAR_HT_ADLER32     73001 
     79#define ROAR_HT_ADLER32     ((roar_hash_t)73001UL) 
    7880 
    7981struct roar_hash_cmds { 
    80  int algo; 
     82 roar_hash_t algo; 
    8183 ssize_t statelen; 
    8284 ssize_t blocksize; 
     
    8890}; 
    8991 
    90 const char * roar_ht2str (const int    ht); 
    91 int          roar_str2ht (const char * ht); 
     92const char * roar_ht2str (const roar_hash_t ht); 
     93roar_hash_t  roar_str2ht (const char * ht); 
    9294 
    93 ssize_t      roar_ht_digestlen (const int    ht); 
     95ssize_t      roar_ht_digestlen (const roar_hash_t ht); 
    9496 
    95 ssize_t      roar_hash_digest2str(char * out, size_t outlen, void * digest, size_t digestlen, int ht); 
     97ssize_t      roar_hash_digest2str(char * out, size_t outlen, void * digest, size_t digestlen, roar_hash_t ht); 
    9698 
    97 int          roar_ht_is_supported(const int    ht); 
     99int          roar_ht_is_supported(const roar_hash_t ht); 
    98100 
    99101struct roar_hash_state; 
    100102 
    101 struct roar_hash_state * roar_hash_new(int algo); 
     103struct roar_hash_state * roar_hash_new(roar_hash_t algo); 
    102104int roar_hash_free(struct roar_hash_state * state); 
    103105int roar_hash_digest(struct roar_hash_state * state, void * digest, size_t * len); 
    104106int roar_hash_proc(struct roar_hash_state * state, const void * data, size_t len); 
    105107 
    106 int roar_hash_buffer(void * digest, const void * data, size_t datalen, int algo); 
    107 int roar_hash_salted_buffer(void * digest, const void * data, size_t datalen, int algo, const void * salt, size_t saltlen); 
     108int roar_hash_buffer(void * digest, const void * data, size_t datalen, roar_hash_t algo); 
     109int roar_hash_salted_buffer(void * digest, const void * data, size_t datalen, roar_hash_t algo, const void * salt, size_t saltlen); 
    108110 
    109111#endif 
Note: See TracChangeset for help on using the changeset viewer.