| 1 | /* |
| 2 | This file is part of Mtproto-proxy Library. |
| 3 | |
| 4 | Mtproto-proxy Library is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as published by |
| 6 | the Free Software Foundation, either version 2 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | Mtproto-proxy Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public License |
| 15 | along with Mtproto-proxy Library. If not, see <http://www.gnu.org/licenses/>. |
| 16 | |
| 17 | Copyright 2009-2012 Vkontakte Ltd |
| 18 | 2009-2012 Nikolai Durov |
| 19 | 2009-2012 Andrey Lopatin |
| 20 | 2012 Anton Maydell |
| 21 | |
| 22 | Copyright 2014 Telegram Messenger Inc |
| 23 | 2014 Anton Maydell |
| 24 | */ |
| 25 | |
| 26 | #pragma once |
| 27 | |
| 28 | #include "common/crc32.h" |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | //extern unsigned int crc32c_table[256]; |
| 35 | extern crc32_partial_func_t crc32c_partial; |
| 36 | extern crc32_combine_func_t compute_crc32c_combine; |
| 37 | |
| 38 | static inline unsigned compute_crc32c (const void *data, int len) { |
| 39 | return crc32c_partial (data, len, -1) ^ -1; |
| 40 | } |
| 41 | |
| 42 | unsigned crc32c_partial_four_tables (const void *data, long len, unsigned crc); |
| 43 | |
| 44 | #ifdef __cplusplus |
| 45 | } |
| 46 | #endif |
| 47 | |