3
#include "exehead/config.h"
4
#ifdef NSIS_CONFIG_CRC_SUPPORT
6
// this is based on the (slow,small) CRC32 implementation from zlib.
7
crc32_t NSISCALL CRC32(crc32_t crc, const unsigned char *buf, unsigned int len)
9
static crc32_t crc_table[256];
16
for (n = 0; n < 256; n++)
19
for (k = 0; k < 8; k++) c = (c >> 1) ^ (c & 1 ? 0xedb88320L : 0);
24
crc = crc ^ 0xffffffffL;
26
crc = crc_table[(crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
28
return crc ^ 0xffffffffL;
4
* This file is a part of NSIS.
6
* Copyright (C) 1999-2008 Nullsoft and Contributors
8
* Licensed under the zlib/libpng license (the "License");
9
* you may not use this file except in compliance with the License.
11
* Licence details can be found in the file COPYING.
13
* This software is provided 'as-is', without any express or implied
19
#include "exehead/config.h"
20
#ifdef NSIS_CONFIG_CRC_SUPPORT
22
// this is based on the (slow,small) CRC32 implementation from zlib.
23
crc32_t NSISCALL CRC32(crc32_t crc, const unsigned char *buf, unsigned int len)
25
static crc32_t crc_table[256];
32
for (n = 0; n < 256; n++)
35
for (k = 0; k < 8; k++) c = (c >> 1) ^ (c & 1 ? 0xedb88320L : 0);
40
crc = crc ^ 0xffffffffL;
42
crc = crc_table[(crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
44
return crc ^ 0xffffffffL;