pwnlib.util.crc — Calculating CRC-sums

Module for calculating CRC-sums.

Contains all crc implementations know on the interwebz. For most implementations it contains only the core crc algorithm and not e.g. padding schemes.

It is horribly slow, as implements a naive algorithm working direclty on bit polynomials. This class is exposed as BitPolynom.

The current algorithm is super-linear and takes about 4 seconds to calculate the crc32-sum of 'A'*40000.

An obvious optimization would be to actually generate some lookup-tables.

class pwnlib.util.crc.BitPolynom(n)[源代码]

Class for representing GF(2)[X], i.e. the field of polynomials over GF(2).

In practice the polynomials are represented as numbers such that x**n corresponds to 1 << n. In this representation calculations are easy: Just do everything as normal, but forget about everything the carries.

Addition becomes xor and multiplication becomes carry-less multiplication.

Examples

>>> p1 = BitPolynom("x**3 + x + 1")
>>> p1
BitPolynom('x**3 + x + 1')
>>> int(p1)
11
>>> p1 == BitPolynom(11)
True
>>> p2 = BitPolynom("x**2 + x + 1")
>>> p1 + p2
BitPolynom('x**3 + x**2')
>>> p1 * p2
BitPolynom('x**5 + x**4 + 1')
>>> p1 / p2
BitPolynom('x + 1')
>>> p1 % p2
BitPolynom('x')
>>> d, r = divmod(p1, p2)
>>> d * p2 + r == p1
True
>>> BitPolynom(-1)
Traceback (most recent call last):
    ...
ValueError: Polynomials cannot be negative: -1
>>> BitPolynom('y')
Traceback (most recent call last):
    ...
ValueError: Not a valid polynomial: y
degree()[源代码]

Returns the degree of the polynomial.

Examples

>>> BitPolynom(0).degree()
0
>>> BitPolynom(1).degree()
0
>>> BitPolynom(2).degree()
1
>>> BitPolynom(7).degree()
2
>>> BitPolynom((1 << 10) - 1).degree()
9
>>> BitPolynom(1 << 10).degree()
10
pwnlib.util.crc.generic_crc(data, polynom, width, init, refin, refout, xorout)[源代码]

A generic CRC-sum function.

This is suitable to use with: http://reveng.sourceforge.net/crc-catalogue/all.htm

The “check” value in the document is the CRC-sum of the string “123456789”.

参数:
  • data (str) – The data to calculate the CRC-sum of. This should either be a string or a list of bits.
  • polynom (int) – The polynomial to use.
  • init (int) – If the CRC-sum was calculated in hardware, then this would b the initial value of the checksum register.
  • refin (bool) – Should the input bytes be reflected?
  • refout (bool) – Should the checksum be reflected?
  • xorout (int) – The value to xor the checksum with before outputting
pwnlib.util.crc.cksum(data) → int[源代码]

Calculates the same checksum as returned by the UNIX-tool cksum.

参数:data (str) – The data to checksum.

Example

>>> print cksum('123456789')
930766865
pwnlib.util.crc.find_crc_function(data, checksum)[源代码]

Finds all known CRC functions that hashes a piece of data into a specific checksum. It does this by trying all known CRC functions one after the other.

参数:data (str) – Data for which the checksum is known.

Example

>>> find_crc_function('test', 46197)
[<function crc_crc_16_dnp at ...>]
pwnlib.util.crc.arc(data) → int[源代码]

Calculates the arc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x8005
  • width = 16
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.16

参数:data (str) – The data to checksum.

Example

>>> print arc('123456789')
47933
pwnlib.util.crc.crc_10(data) → int[源代码]

Calculates the crc_10 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x233
  • width = 10
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.10

参数:data (str) – The data to checksum.

Example

>>> print crc_10('123456789')
409
pwnlib.util.crc.crc_10_cdma2000(data) → int[源代码]

Calculates the crc_10_cdma2000 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x3d9
  • width = 10
  • init = 0x3ff
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-10-cdma2000

参数:data (str) – The data to checksum.

Example

>>> print crc_10_cdma2000('123456789')
563
pwnlib.util.crc.crc_10_gsm(data) → int[源代码]

Calculates the crc_10_gsm checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x175
  • width = 10
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x3ff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-10-gsm

参数:data (str) – The data to checksum.

Example

>>> print crc_10_gsm('123456789')
298
pwnlib.util.crc.crc_11(data) → int[源代码]

Calculates the crc_11 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x385
  • width = 11
  • init = 0x1a
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.11

参数:data (str) – The data to checksum.

Example

>>> print crc_11('123456789')
1443
pwnlib.util.crc.crc_11_umts(data) → int[源代码]

Calculates the crc_11_umts checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x307
  • width = 11
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-11-umts

参数:data (str) – The data to checksum.

Example

>>> print crc_11_umts('123456789')
97
pwnlib.util.crc.crc_12_cdma2000(data) → int[源代码]

Calculates the crc_12_cdma2000 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0xf13
  • width = 12
  • init = 0xfff
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.12

参数:data (str) – The data to checksum.

Example

>>> print crc_12_cdma2000('123456789')
3405
pwnlib.util.crc.crc_12_dect(data) → int[源代码]

Calculates the crc_12_dect checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x80f
  • width = 12
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-12-dect

参数:data (str) – The data to checksum.

Example

>>> print crc_12_dect('123456789')
3931
pwnlib.util.crc.crc_12_gsm(data) → int[源代码]

Calculates the crc_12_gsm checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0xd31
  • width = 12
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0xfff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-12-gsm

参数:data (str) – The data to checksum.

Example

>>> print crc_12_gsm('123456789')
2868
pwnlib.util.crc.crc_12_umts(data) → int[源代码]

Calculates the crc_12_umts checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x80f
  • width = 12
  • init = 0x0
  • refin = False
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-12-umts

参数:data (str) – The data to checksum.

Example

>>> print crc_12_umts('123456789')
3503
pwnlib.util.crc.crc_13_bbc(data) → int[源代码]

Calculates the crc_13_bbc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1cf5
  • width = 13
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.13

参数:data (str) – The data to checksum.

Example

>>> print crc_13_bbc('123456789')
1274
pwnlib.util.crc.crc_14_darc(data) → int[源代码]

Calculates the crc_14_darc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x805
  • width = 14
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.14

参数:data (str) – The data to checksum.

Example

>>> print crc_14_darc('123456789')
2093
pwnlib.util.crc.crc_14_gsm(data) → int[源代码]

Calculates the crc_14_gsm checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x202d
  • width = 14
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x3fff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-14-gsm

参数:data (str) – The data to checksum.

Example

>>> print crc_14_gsm('123456789')
12462
pwnlib.util.crc.crc_15(data) → int[源代码]

Calculates the crc_15 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x4599
  • width = 15
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.15

参数:data (str) – The data to checksum.

Example

>>> print crc_15('123456789')
1438
pwnlib.util.crc.crc_15_mpt1327(data) → int[源代码]

Calculates the crc_15_mpt1327 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x6815
  • width = 15
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x1

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-15-mpt1327

参数:data (str) – The data to checksum.

Example

>>> print crc_15_mpt1327('123456789')
9574
pwnlib.util.crc.crc_16_aug_ccitt(data) → int[源代码]

Calculates the crc_16_aug_ccitt checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0x1d0f
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-aug-ccitt

参数:data (str) – The data to checksum.

Example

>>> print crc_16_aug_ccitt('123456789')
58828
pwnlib.util.crc.crc_16_buypass(data) → int[源代码]

Calculates the crc_16_buypass checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x8005
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-buypass

参数:data (str) – The data to checksum.

Example

>>> print crc_16_buypass('123456789')
65256
pwnlib.util.crc.crc_16_ccitt_false(data) → int[源代码]

Calculates the crc_16_ccitt_false checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0xffff
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-ccitt-false

参数:data (str) – The data to checksum.

Example

>>> print crc_16_ccitt_false('123456789')
10673
pwnlib.util.crc.crc_16_cdma2000(data) → int[源代码]

Calculates the crc_16_cdma2000 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0xc867
  • width = 16
  • init = 0xffff
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-cdma2000

参数:data (str) – The data to checksum.

Example

>>> print crc_16_cdma2000('123456789')
19462
pwnlib.util.crc.crc_16_cms(data) → int[源代码]

Calculates the crc_16_cms checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x8005
  • width = 16
  • init = 0xffff
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-cms

参数:data (str) – The data to checksum.

Example

>>> print crc_16_cms('123456789')
44775
pwnlib.util.crc.crc_16_dds_110(data) → int[源代码]

Calculates the crc_16_dds_110 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x8005
  • width = 16
  • init = 0x800d
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-dds-110

参数:data (str) – The data to checksum.

Example

>>> print crc_16_dds_110('123456789')
40655
pwnlib.util.crc.crc_16_dect_r(data) → int[源代码]

Calculates the crc_16_dect_r checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x589
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x1

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-dect-r

参数:data (str) – The data to checksum.

Example

>>> print crc_16_dect_r('123456789')
126
pwnlib.util.crc.crc_16_dect_x(data) → int[源代码]

Calculates the crc_16_dect_x checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x589
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-dect-x

参数:data (str) – The data to checksum.

Example

>>> print crc_16_dect_x('123456789')
127
pwnlib.util.crc.crc_16_dnp(data) → int[源代码]

Calculates the crc_16_dnp checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x3d65
  • width = 16
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0xffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-dnp

参数:data (str) – The data to checksum.

Example

>>> print crc_16_dnp('123456789')
60034
pwnlib.util.crc.crc_16_en_13757(data) → int[源代码]

Calculates the crc_16_en_13757 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x3d65
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0xffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-en-13757

参数:data (str) – The data to checksum.

Example

>>> print crc_16_en_13757('123456789')
49847
pwnlib.util.crc.crc_16_genibus(data) → int[源代码]

Calculates the crc_16_genibus checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0xffff
  • refin = False
  • refout = False
  • xorout = 0xffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-genibus

参数:data (str) – The data to checksum.

Example

>>> print crc_16_genibus('123456789')
54862
pwnlib.util.crc.crc_16_gsm(data) → int[源代码]

Calculates the crc_16_gsm checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0xffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-gsm

参数:data (str) – The data to checksum.

Example

>>> print crc_16_gsm('123456789')
52796
pwnlib.util.crc.crc_16_lj1200(data) → int[源代码]

Calculates the crc_16_lj1200 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x6f63
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-lj1200

参数:data (str) – The data to checksum.

Example

>>> print crc_16_lj1200('123456789')
48628
pwnlib.util.crc.crc_16_maxim(data) → int[源代码]

Calculates the crc_16_maxim checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x8005
  • width = 16
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0xffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-maxim

参数:data (str) – The data to checksum.

Example

>>> print crc_16_maxim('123456789')
17602
pwnlib.util.crc.crc_16_mcrf4xx(data) → int[源代码]

Calculates the crc_16_mcrf4xx checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0xffff
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-mcrf4xx

参数:data (str) – The data to checksum.

Example

>>> print crc_16_mcrf4xx('123456789')
28561
pwnlib.util.crc.crc_16_opensafety_a(data) → int[源代码]

Calculates the crc_16_opensafety_a checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x5935
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-opensafety-a

参数:data (str) – The data to checksum.

Example

>>> print crc_16_opensafety_a('123456789')
23864
pwnlib.util.crc.crc_16_opensafety_b(data) → int[源代码]

Calculates the crc_16_opensafety_b checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x755b
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-opensafety-a

参数:data (str) – The data to checksum.

Example

>>> print crc_16_opensafety_b('123456789')
8446
pwnlib.util.crc.crc_16_profibus(data) → int[源代码]

Calculates the crc_16_profibus checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1dcf
  • width = 16
  • init = 0xffff
  • refin = False
  • refout = False
  • xorout = 0xffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-profibus

参数:data (str) – The data to checksum.

Example

>>> print crc_16_profibus('123456789')
43033
pwnlib.util.crc.crc_16_riello(data) → int[源代码]

Calculates the crc_16_riello checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0xb2aa
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-riello

参数:data (str) – The data to checksum.

Example

>>> print crc_16_riello('123456789')
25552
pwnlib.util.crc.crc_16_t10_dif(data) → int[源代码]

Calculates the crc_16_t10_dif checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x8bb7
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-t10-dif

参数:data (str) – The data to checksum.

Example

>>> print crc_16_t10_dif('123456789')
53467
pwnlib.util.crc.crc_16_teledisk(data) → int[源代码]

Calculates the crc_16_teledisk checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0xa097
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-teledisk

参数:data (str) – The data to checksum.

Example

>>> print crc_16_teledisk('123456789')
4019
pwnlib.util.crc.crc_16_tms37157(data) → int[源代码]

Calculates the crc_16_tms37157 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0x89ec
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-tms37157

参数:data (str) – The data to checksum.

Example

>>> print crc_16_tms37157('123456789')
9905
pwnlib.util.crc.crc_16_usb(data) → int[源代码]

Calculates the crc_16_usb checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x8005
  • width = 16
  • init = 0xffff
  • refin = True
  • refout = True
  • xorout = 0xffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-16-usb

参数:data (str) – The data to checksum.

Example

>>> print crc_16_usb('123456789')
46280
pwnlib.util.crc.crc_24(data) → int[源代码]

Calculates the crc_24 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x864cfb
  • width = 24
  • init = 0xb704ce
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.24

参数:data (str) – The data to checksum.

Example

>>> print crc_24('123456789')
2215682
pwnlib.util.crc.crc_24_ble(data) → int[源代码]

Calculates the crc_24_ble checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x65b
  • width = 24
  • init = 0x555555
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-24-ble

参数:data (str) – The data to checksum.

Example

>>> print crc_24_ble('123456789')
12737110
pwnlib.util.crc.crc_24_flexray_a(data) → int[源代码]

Calculates the crc_24_flexray_a checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x5d6dcb
  • width = 24
  • init = 0xfedcba
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-24-flexray-a

参数:data (str) – The data to checksum.

Example

>>> print crc_24_flexray_a('123456789')
7961021
pwnlib.util.crc.crc_24_flexray_b(data) → int[源代码]

Calculates the crc_24_flexray_b checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x5d6dcb
  • width = 24
  • init = 0xabcdef
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-24-flexray-b

参数:data (str) – The data to checksum.

Example

>>> print crc_24_flexray_b('123456789')
2040760
pwnlib.util.crc.crc_24_interlaken(data) → int[源代码]

Calculates the crc_24_interlaken checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x328b63
  • width = 24
  • init = 0xffffff
  • refin = False
  • refout = False
  • xorout = 0xffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-24-interlaken

参数:data (str) – The data to checksum.

Example

>>> print crc_24_interlaken('123456789')
11858918
pwnlib.util.crc.crc_24_lte_a(data) → int[源代码]

Calculates the crc_24_lte_a checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x864cfb
  • width = 24
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-24-lte-a

参数:data (str) – The data to checksum.

Example

>>> print crc_24_lte_a('123456789')
13494019
pwnlib.util.crc.crc_24_lte_b(data) → int[源代码]

Calculates the crc_24_lte_b checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x800063
  • width = 24
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-24-lte-b

参数:data (str) – The data to checksum.

Example

>>> print crc_24_lte_b('123456789')
2355026
pwnlib.util.crc.crc_30_cdma(data) → int[源代码]

Calculates the crc_30_cdma checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x2030b9c7
  • width = 30
  • init = 0x3fffffff
  • refin = False
  • refout = False
  • xorout = 0x3fffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.30

参数:data (str) – The data to checksum.

Example

>>> print crc_30_cdma('123456789')
79907519
pwnlib.util.crc.crc_31_philips(data) → int[源代码]

Calculates the crc_31_philips checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x4c11db7
  • width = 31
  • init = 0x7fffffff
  • refin = False
  • refout = False
  • xorout = 0x7fffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.31

参数:data (str) – The data to checksum.

Example

>>> print crc_31_philips('123456789')
216654956
pwnlib.util.crc.crc_32(data) → int[源代码]

Calculates the crc_32 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x4c11db7
  • width = 32
  • init = 0xffffffff
  • refin = True
  • refout = True
  • xorout = 0xffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.32

参数:data (str) – The data to checksum.

Example

>>> print crc_32('123456789')
3421780262
pwnlib.util.crc.crc_32_autosar(data) → int[源代码]

Calculates the crc_32_autosar checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0xf4acfb13
  • width = 32
  • init = 0xffffffff
  • refin = True
  • refout = True
  • xorout = 0xffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32-autosar

参数:data (str) – The data to checksum.

Example

>>> print crc_32_autosar('123456789')
379048042
pwnlib.util.crc.crc_32_bzip2(data) → int[源代码]

Calculates the crc_32_bzip2 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x4c11db7
  • width = 32
  • init = 0xffffffff
  • refin = False
  • refout = False
  • xorout = 0xffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32-bzip2

参数:data (str) – The data to checksum.

Example

>>> print crc_32_bzip2('123456789')
4236843288
pwnlib.util.crc.crc_32_mpeg_2(data) → int[源代码]

Calculates the crc_32_mpeg_2 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x4c11db7
  • width = 32
  • init = 0xffffffff
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32-mpeg-2

参数:data (str) – The data to checksum.

Example

>>> print crc_32_mpeg_2('123456789')
58124007
pwnlib.util.crc.crc_32_posix(data) → int[源代码]

Calculates the crc_32_posix checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x4c11db7
  • width = 32
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0xffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32-posix

参数:data (str) – The data to checksum.

Example

>>> print crc_32_posix('123456789')
1985902208
pwnlib.util.crc.crc_32c(data) → int[源代码]

Calculates the crc_32c checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1edc6f41
  • width = 32
  • init = 0xffffffff
  • refin = True
  • refout = True
  • xorout = 0xffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32c

参数:data (str) – The data to checksum.

Example

>>> print crc_32c('123456789')
3808858755
pwnlib.util.crc.crc_32d(data) → int[源代码]

Calculates the crc_32d checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0xa833982b
  • width = 32
  • init = 0xffffffff
  • refin = True
  • refout = True
  • xorout = 0xffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32d

参数:data (str) – The data to checksum.

Example

>>> print crc_32d('123456789')
2268157302
pwnlib.util.crc.crc_32q(data) → int[源代码]

Calculates the crc_32q checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x814141ab
  • width = 32
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32q

参数:data (str) – The data to checksum.

Example

>>> print crc_32q('123456789')
806403967
pwnlib.util.crc.crc_3_gsm(data) → int[源代码]

Calculates the crc_3_gsm checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x3
  • width = 3
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x7

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.3

参数:data (str) – The data to checksum.

Example

>>> print crc_3_gsm('123456789')
4
pwnlib.util.crc.crc_3_rohc(data) → int[源代码]

Calculates the crc_3_rohc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x3
  • width = 3
  • init = 0x7
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-3-rohc

参数:data (str) – The data to checksum.

Example

>>> print crc_3_rohc('123456789')
6
pwnlib.util.crc.crc_40_gsm(data) → int[源代码]

Calculates the crc_40_gsm checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x4820009
  • width = 40
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0xffffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.40

参数:data (str) – The data to checksum.

Example

>>> print crc_40_gsm('123456789')
910907393606
pwnlib.util.crc.crc_4_interlaken(data) → int[源代码]

Calculates the crc_4_interlaken checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x3
  • width = 4
  • init = 0xf
  • refin = False
  • refout = False
  • xorout = 0xf

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.4

参数:data (str) – The data to checksum.

Example

>>> print crc_4_interlaken('123456789')
11
pwnlib.util.crc.crc_4_itu(data) → int[源代码]

Calculates the crc_4_itu checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x3
  • width = 4
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-4-itu

参数:data (str) – The data to checksum.

Example

>>> print crc_4_itu('123456789')
7
pwnlib.util.crc.crc_5_epc(data) → int[源代码]

Calculates the crc_5_epc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x9
  • width = 5
  • init = 0x9
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.5

参数:data (str) – The data to checksum.

Example

>>> print crc_5_epc('123456789')
0
pwnlib.util.crc.crc_5_itu(data) → int[源代码]

Calculates the crc_5_itu checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x15
  • width = 5
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-5-itu

参数:data (str) – The data to checksum.

Example

>>> print crc_5_itu('123456789')
7
pwnlib.util.crc.crc_5_usb(data) → int[源代码]

Calculates the crc_5_usb checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x5
  • width = 5
  • init = 0x1f
  • refin = True
  • refout = True
  • xorout = 0x1f

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-5-usb

参数:data (str) – The data to checksum.

Example

>>> print crc_5_usb('123456789')
25
pwnlib.util.crc.crc_64(data) → int[源代码]

Calculates the crc_64 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x42f0e1eba9ea3693
  • width = 64
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.64

参数:data (str) – The data to checksum.

Example

>>> print crc_64('123456789')
7800480153909949255
pwnlib.util.crc.crc_64_go_iso(data) → int[源代码]

Calculates the crc_64_go_iso checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1b
  • width = 64
  • init = 0xffffffffffffffff
  • refin = True
  • refout = True
  • xorout = 0xffffffffffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-64-go-iso

参数:data (str) – The data to checksum.

Example

>>> print crc_64_go_iso('123456789')
13333283586479230977
pwnlib.util.crc.crc_64_we(data) → int[源代码]

Calculates the crc_64_we checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x42f0e1eba9ea3693
  • width = 64
  • init = 0xffffffffffffffff
  • refin = False
  • refout = False
  • xorout = 0xffffffffffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-64-we

参数:data (str) – The data to checksum.

Example

>>> print crc_64_we('123456789')
7128171145767219210
pwnlib.util.crc.crc_64_xz(data) → int[源代码]

Calculates the crc_64_xz checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x42f0e1eba9ea3693
  • width = 64
  • init = 0xffffffffffffffff
  • refin = True
  • refout = True
  • xorout = 0xffffffffffffffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-64-xz

参数:data (str) – The data to checksum.

Example

>>> print crc_64_xz('123456789')
11051210869376104954
pwnlib.util.crc.crc_6_cdma2000_a(data) → int[源代码]

Calculates the crc_6_cdma2000_a checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x27
  • width = 6
  • init = 0x3f
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.6

参数:data (str) – The data to checksum.

Example

>>> print crc_6_cdma2000_a('123456789')
13
pwnlib.util.crc.crc_6_cdma2000_b(data) → int[源代码]

Calculates the crc_6_cdma2000_b checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x7
  • width = 6
  • init = 0x3f
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-6-cdma2000-b

参数:data (str) – The data to checksum.

Example

>>> print crc_6_cdma2000_b('123456789')
59
pwnlib.util.crc.crc_6_darc(data) → int[源代码]

Calculates the crc_6_darc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x19
  • width = 6
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-6-darc

参数:data (str) – The data to checksum.

Example

>>> print crc_6_darc('123456789')
38
pwnlib.util.crc.crc_6_gsm(data) → int[源代码]

Calculates the crc_6_gsm checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x2f
  • width = 6
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x3f

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-6-gsm

参数:data (str) – The data to checksum.

Example

>>> print crc_6_gsm('123456789')
19
pwnlib.util.crc.crc_6_itu(data) → int[源代码]

Calculates the crc_6_itu checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x3
  • width = 6
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-6-itu

参数:data (str) – The data to checksum.

Example

>>> print crc_6_itu('123456789')
6
pwnlib.util.crc.crc_7(data) → int[源代码]

Calculates the crc_7 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x9
  • width = 7
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.7

参数:data (str) – The data to checksum.

Example

>>> print crc_7('123456789')
117
pwnlib.util.crc.crc_7_rohc(data) → int[源代码]

Calculates the crc_7_rohc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x4f
  • width = 7
  • init = 0x7f
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-7-rohc

参数:data (str) – The data to checksum.

Example

>>> print crc_7_rohc('123456789')
83
pwnlib.util.crc.crc_7_umts(data) → int[源代码]

Calculates the crc_7_umts checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x45
  • width = 7
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-7-umts

参数:data (str) – The data to checksum.

Example

>>> print crc_7_umts('123456789')
97
pwnlib.util.crc.crc_8(data) → int[源代码]

Calculates the crc_8 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x7
  • width = 8
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.8

参数:data (str) – The data to checksum.

Example

>>> print crc_8('123456789')
244
pwnlib.util.crc.crc_82_darc(data) → int[源代码]

Calculates the crc_82_darc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x308c0111011401440411
  • width = 82
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat-bits.82

参数:data (str) – The data to checksum.

Example

>>> print crc_82_darc('123456789')
749237524598872659187218
pwnlib.util.crc.crc_8_autosar(data) → int[源代码]

Calculates the crc_8_autosar checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x2f
  • width = 8
  • init = 0xff
  • refin = False
  • refout = False
  • xorout = 0xff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-autosar

参数:data (str) – The data to checksum.

Example

>>> print crc_8_autosar('123456789')
223
pwnlib.util.crc.crc_8_cdma2000(data) → int[源代码]

Calculates the crc_8_cdma2000 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x9b
  • width = 8
  • init = 0xff
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-cdma2000

参数:data (str) – The data to checksum.

Example

>>> print crc_8_cdma2000('123456789')
218
pwnlib.util.crc.crc_8_darc(data) → int[源代码]

Calculates the crc_8_darc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x39
  • width = 8
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-darc

参数:data (str) – The data to checksum.

Example

>>> print crc_8_darc('123456789')
21
pwnlib.util.crc.crc_8_dvb_s2(data) → int[源代码]

Calculates the crc_8_dvb_s2 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0xd5
  • width = 8
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-dvb-s2

参数:data (str) – The data to checksum.

Example

>>> print crc_8_dvb_s2('123456789')
188
pwnlib.util.crc.crc_8_ebu(data) → int[源代码]

Calculates the crc_8_ebu checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1d
  • width = 8
  • init = 0xff
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-ebu

参数:data (str) – The data to checksum.

Example

>>> print crc_8_ebu('123456789')
151
pwnlib.util.crc.crc_8_gsm_a(data) → int[源代码]

Calculates the crc_8_gsm_a checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1d
  • width = 8
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-gsm-a

参数:data (str) – The data to checksum.

Example

>>> print crc_8_gsm_a('123456789')
55
pwnlib.util.crc.crc_8_gsm_b(data) → int[源代码]

Calculates the crc_8_gsm_b checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x49
  • width = 8
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0xff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-gsm-b

参数:data (str) – The data to checksum.

Example

>>> print crc_8_gsm_b('123456789')
148
pwnlib.util.crc.crc_8_i_code(data) → int[源代码]

Calculates the crc_8_i_code checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1d
  • width = 8
  • init = 0xfd
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-i-code

参数:data (str) – The data to checksum.

Example

>>> print crc_8_i_code('123456789')
126
pwnlib.util.crc.crc_8_itu(data) → int[源代码]

Calculates the crc_8_itu checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x7
  • width = 8
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x55

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-itu

参数:data (str) – The data to checksum.

Example

>>> print crc_8_itu('123456789')
161
pwnlib.util.crc.crc_8_lte(data) → int[源代码]

Calculates the crc_8_lte checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x9b
  • width = 8
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-lte

参数:data (str) – The data to checksum.

Example

>>> print crc_8_lte('123456789')
234
pwnlib.util.crc.crc_8_maxim(data) → int[源代码]

Calculates the crc_8_maxim checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x31
  • width = 8
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-maxim

参数:data (str) – The data to checksum.

Example

>>> print crc_8_maxim('123456789')
161
pwnlib.util.crc.crc_8_opensafety(data) → int[源代码]

Calculates the crc_8_opensafety checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x2f
  • width = 8
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-opensafety

参数:data (str) – The data to checksum.

Example

>>> print crc_8_opensafety('123456789')
62
pwnlib.util.crc.crc_8_rohc(data) → int[源代码]

Calculates the crc_8_rohc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x7
  • width = 8
  • init = 0xff
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-rohc

参数:data (str) – The data to checksum.

Example

>>> print crc_8_rohc('123456789')
208
pwnlib.util.crc.crc_8_sae_j1850(data) → int[源代码]

Calculates the crc_8_sae_j1850 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1d
  • width = 8
  • init = 0xff
  • refin = False
  • refout = False
  • xorout = 0xff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-sae-j1850

参数:data (str) – The data to checksum.

Example

>>> print crc_8_sae_j1850('123456789')
75
pwnlib.util.crc.crc_8_wcdma(data) → int[源代码]

Calculates the crc_8_wcdma checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x9b
  • width = 8
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-8-wdcma

参数:data (str) – The data to checksum.

Example

>>> print crc_8_wcdma('123456789')
37
pwnlib.util.crc.crc_a(data) → int[源代码]

Calculates the crc_a checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0xc6c6
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-a

参数:data (str) – The data to checksum.

Example

>>> print crc_a('123456789')
48901
pwnlib.util.crc.jamcrc(data) → int[源代码]

Calculates the jamcrc checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x4c11db7
  • width = 32
  • init = 0xffffffff
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.jamcrc

参数:data (str) – The data to checksum.

Example

>>> print jamcrc('123456789')
873187033
pwnlib.util.crc.kermit(data) → int[源代码]

Calculates the kermit checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0x0
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.kermit

参数:data (str) – The data to checksum.

Example

>>> print kermit('123456789')
8585
pwnlib.util.crc.modbus(data) → int[源代码]

Calculates the modbus checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x8005
  • width = 16
  • init = 0xffff
  • refin = True
  • refout = True
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.modbus

参数:data (str) – The data to checksum.

Example

>>> print modbus('123456789')
19255
pwnlib.util.crc.x_25(data) → int[源代码]

Calculates the x_25 checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0xffff
  • refin = True
  • refout = True
  • xorout = 0xffff

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.x-25

参数:data (str) – The data to checksum.

Example

>>> print x_25('123456789')
36974
pwnlib.util.crc.xfer(data) → int[源代码]

Calculates the xfer checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0xaf
  • width = 32
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.xfer

参数:data (str) – The data to checksum.

Example

>>> print xfer('123456789')
3171672888
pwnlib.util.crc.xmodem(data) → int[源代码]

Calculates the xmodem checksum.

This is simply the generic_crc() with these frozen arguments:

  • polynom = 0x1021
  • width = 16
  • init = 0x0
  • refin = False
  • refout = False
  • xorout = 0x0

See also: http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.xmodem

参数:data (str) – The data to checksum.

Example

>>> print xmodem('123456789')
12739