SWISS::CRC64(3pm)

πŸ“¦
version 1.80 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ SWISS::CRC64 ✨

okay bestie, this is the CRC64 perl module documentation, aka SWISS::CRC64(3pm) β€” yes it lives in the perl world, and yes it's here to do exactly one slay thing: math. πŸ’…


πŸ’– NAME πŸ’–

CRC64 β€” Calculate the cyclic redundancy check. that's it. that's the whole job. lowkey iconic.


πŸ¦‹ SYNOPSIS πŸ¦‹

use SWISS::CRC64;

$crc = SWISS::CRC64::crc64("IHATEMATH");
#returns the string "E3DCADD69B01ADD1"

($crc_low, $crc_high) = SWISS::CRC64::crc64("IHATEMATH");
#returns two 32-bit unsigned integers, 3822890454 and 2600578513

not the example string being "IHATEMATH" 😭 the original author was going through something fr fr. anyway, notice how one call gives you a cute lil string and the other gives you two numbers β€” that's the whole vibe check, more on that below ⬇️


🌸 DESCRIPTION 🌸

so SWISS-PROT + TREMBL use a 64-bit Cyclic Redundancy Check for amino acid sequences. it's giving checksum, it's giving "did this sequence get corrupted or not", and honestly? we're obsessed. ✨

the algorithm to compute the CRC is described in the ISO 3309 standard. the generator polynomial is:

x64 + x4 + x3 + x + 1

and the reference, no cap, is: W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery, "Numerical recipes in C", 2nd ed., Cambridge University Press. Pages 896ff. πŸ“š


πŸŽ€ Functions πŸŽ€

πŸ’œ crc64 string

Calculate the CRC64 (cyclic redundancy checksum) for string. it's the main character of this module, obviously. πŸ‘‘

now here's the tea about context, because perl really said "why not both":

  • In array context, returns two integers equal to the higher and lower 32 bits of the CRC64.
  • In scalar context, returns a 16-character string containing the CRC64 in hexadecimal format.

so yeah β€” same function, two completely different returns depending on the vibe you call it in. perl behavior fr. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Alexandre Gattiker, gattiker@isb-sib.ch β€” the legend, the moment, the blueprint. πŸ’–


🌈 ACKNOWLEDGEMENTS 🌈

based on SPcrc, a C implementation by Christian Iseli, available at:

ftp://ftp.ebi.ac.uk/pub/software/swissprot/Swissknife/old/SPcrc.tar.gz

shoutout to the C girlies, we love a foundational implementation. 🧚


and that's the whole page, bestie! 🌟 this was perl v5.32.1, dated 2021-08-15, from the SWISS::CRC64(3pm) manual. mwah, go checksum something. πŸ’…πŸ“

πŸ“¦ where this page comes from