被永久保护的模块

模組:Crc32lua

维基百科,自由的百科全书
跳到导航 跳到搜索
文档图示 模块文档[创建]
--[[

LUA MODULE

  digest.crc32 - CRC-32 checksum implemented entirely in Lua.

SYNOPSIS

  local CRC = require 'digest.crc32lua'
  print(CRC.crc32 'test') --> 0xD87F7E0C or -662733300
  
  assert(CRC.crc32('st', CRC.crc32('te')) == CRC.crc32 'test')
  
DESCRIPTION

  This can be used to compute CRC-32 checksums on strings.
  This is similar to [1-2].

API

  Note: in the functions below, checksums are 32-bit integers stored in
  numbers.  The number format currently depends on the bit
  implementation--see DESIGN NOTES below.

  CRC.crc32_byte(byte [, crc]) --> rcrc
  
    Returns CRC-32 checksum `rcrc` of byte `byte` (number 0..255) appended to
    a string with CRC-32 checksum `crc`.  `crc` defaults to 0 (empty string)
    if omitted.

  CRC.crc32_string(s, crc) --> bcrc

    Returns CRC-32 checksum `rcrc` of string `s` appended to
    a string with CRC-32 checksum `crc`.  `crc` defaults to 0 (empty string)
    if omitted.