[4446] | 1 | //hash.h: |
---|
| 2 | |
---|
| 3 | /* |
---|
[4708] | 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2011 |
---|
[4446] | 5 | * |
---|
| 6 | * This file is part of libroar a part of RoarAudio, |
---|
| 7 | * a cross-platform sound system for both, home and professional use. |
---|
| 8 | * See README for details. |
---|
| 9 | * |
---|
| 10 | * This file is free software; you can redistribute it and/or modify |
---|
| 11 | * it under the terms of the GNU General Public License version 3 |
---|
| 12 | * as published by the Free Software Foundation. |
---|
| 13 | * |
---|
| 14 | * libroar is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this software; see the file COPYING. If not, write to |
---|
| 21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
| 22 | * Boston, MA 02110-1301, USA. |
---|
| 23 | * |
---|
| 24 | * NOTE for everyone want's to change something and send patches: |
---|
| 25 | * read README and HACKING! There a addition information on |
---|
| 26 | * the license of this document you need to read before you send |
---|
| 27 | * any patches. |
---|
| 28 | * |
---|
| 29 | * NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc |
---|
| 30 | * or libpulse*: |
---|
| 31 | * The libs libroaresd, libroararts and libroarpulse link this lib |
---|
| 32 | * and are therefore GPL. Because of this it may be illigal to use |
---|
| 33 | * them with any software that uses libesd, libartsc or libpulse*. |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | #ifndef _LIBROARHASH_H_ |
---|
| 37 | #define _LIBROARHASH_H_ |
---|
| 38 | |
---|
| 39 | #include "libroar.h" |
---|
| 40 | |
---|
[4449] | 41 | // 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 |
---|
| 76 | #define ROAR_HT_ISBN13 ROAR_HT_GTIN13 |
---|
[4795] | 77 | #define ROAR_HT_ADLER32 73001 |
---|
[4449] | 78 | |
---|
[4670] | 79 | struct roar_hash_cmds { |
---|
| 80 | int algo; |
---|
| 81 | ssize_t statelen; |
---|
| 82 | ssize_t blocksize; |
---|
| 83 | int (*init)(void * state); |
---|
| 84 | int (*uninit)(void * state); |
---|
| 85 | int (*digest)(void * state, void * digest, size_t * len); |
---|
| 86 | int (*proc_block)(void * state, const void * block); |
---|
| 87 | int (*proc)(void * state, const void * data, size_t len); |
---|
| 88 | }; |
---|
| 89 | |
---|
[4450] | 90 | const char * roar_ht2str (const int ht); |
---|
| 91 | int roar_str2ht (const char * ht); |
---|
| 92 | |
---|
[4453] | 93 | ssize_t roar_ht_digestlen (const int ht); |
---|
| 94 | |
---|
[4878] | 95 | ssize_t roar_hash_digest2str(char * out, size_t outlen, void * digest, size_t digestlen, int ht); |
---|
[4877] | 96 | |
---|
[4453] | 97 | int roar_ht_is_supported(const int ht); |
---|
| 98 | |
---|
[4450] | 99 | struct roar_hash_state; |
---|
| 100 | |
---|
[4670] | 101 | struct roar_hash_state * roar_hash_new(int algo); |
---|
| 102 | int roar_hash_free(struct roar_hash_state * state); |
---|
| 103 | int roar_hash_digest(struct roar_hash_state * state, void * digest, size_t * len); |
---|
| 104 | int roar_hash_proc(struct roar_hash_state * state, const void * data, size_t len); |
---|
| 105 | |
---|
[4450] | 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); |
---|
| 108 | |
---|
[4446] | 109 | #endif |
---|
| 110 | |
---|
| 111 | //ll |
---|