function memoizedCreateCrc64
memoizedCreateCrc64(polynomial: bigint): (data: Uint8Array) => bigint

Memoized version of createCrc64.

Calling with the same polynomial returns the cached function.

Examples

Example 1

import { assertEquals } from "@std/assert";
import { memoizedCreateCrc64, CRC64_ECMA_POLYNOMIAL } from "@hertzg/crc/crc64";

const crc64 = memoizedCreateCrc64(CRC64_ECMA_POLYNOMIAL);

assertEquals(crc64(new TextEncoder().encode("123456789")), 0x995dc9bbdf1939fan);

Parameters

polynomial: bigint

The CRC64 polynomial to use (must be BigInt)

Return Type

(data: Uint8Array) => bigint

A function that calculates CRC64 for given data

Usage

import { memoizedCreateCrc64 } from "crc64.ts";