mirror of
https://github.com/urbit/ares.git
synced 2024-11-26 09:57:56 +03:00
pma: wip: forgot checksum.h
This commit is contained in:
parent
add377b007
commit
accf255b1a
66
rust/ares_pma/c-src/lib/checksum.h
Normal file
66
rust/ares_pma/c-src/lib/checksum.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Library: libcrc
|
||||
* File: include/checksum.h (herein src/includes/checksum.h)
|
||||
* Author: Lammert Bies
|
||||
*
|
||||
* This file is licensed under the MIT License as stated below
|
||||
*
|
||||
* Copyright (c) 1999-2016 Lammert Bies
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* -----------
|
||||
* Accessed in 2023 by Alex Shelkovnykov on behalf of Tlon Corporation from
|
||||
* https://github.com/lammertb/libcrc/tree/v2.0.
|
||||
*
|
||||
* Description
|
||||
* -----------
|
||||
* The headerfile src/includes/checksum.h contains the definitions and
|
||||
* prototypes for routines that can be used to calculate several kinds of
|
||||
* checksums.
|
||||
*/
|
||||
|
||||
#ifndef DEF_LIBCRC_CHECKSUM_H
|
||||
#define DEF_LIBCRC_CHECKSUM_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* #define CRC_POLY_xxxx
|
||||
*
|
||||
* The constants of the form CRC_POLY_xxxx define the polynomials for some well
|
||||
* known CRC calculations.
|
||||
*/
|
||||
#define CRC_POLY_32 0xEDB88320L
|
||||
|
||||
/*
|
||||
* #define CRC_START_xxxx
|
||||
*
|
||||
* The constants of the form CRC_START_xxxx define the values that are used for
|
||||
* initialization of a CRC value for common used calculation methods.
|
||||
*/
|
||||
#define CRC_START_32 0xFFFFFFFFL
|
||||
|
||||
/*
|
||||
* Prototype list of global functions
|
||||
*/
|
||||
uint32_t crc_32(const unsigned char *input_str, size_t num_bytes);
|
||||
uint32_t update_crc_32(uint32_t crc, unsigned char c);
|
||||
|
||||
#endif // DEF_LIBCRC_CHECKSUM_H
|
Loading…
Reference in New Issue
Block a user