]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - vtoycli/crc32.c
1 /******************************************************************************
2 * vtoygpt.c ---- ventoy gpt util
4 * Copyright (c) 2020, longpanda <admin@ventoy.net>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
27 #define UINT64 unsigned long long
28 #define UINT32 unsigned int
29 #define UINT16 unsigned short
30 #define CHAR16 unsigned short
31 #define UINT8 unsigned char
33 UINT32 g_crc_table
[256] = {
292 UINT32
VtoyCrc32(VOID
*Buffer
, UINT32 Length
)
296 UINT32 Crc
= 0xFFFFFFFF;
298 for (i
= 0; i
< Length
; i
++, Ptr
++)
300 Crc
= (Crc
>> 8) ^ g_crc_table
[(UINT8
) Crc
^ *Ptr
];
303 return Crc
^ 0xffffffff;