Skip to main content
100%

CRC32 implementation in Power Query M mostly inpired by the article about CRC32 computation http://www.sunshine2k.de/articles/coding/crc/understanding_crc.html and Bit Hacks https://graphics.stanford.edu/~seander/bithacks.htm

✓ Published0🌍 Public
HHugoberry
Last edited Feb 27, 2017
Created on Jan 24, 2017

This example demonstrates a complete CRC32 implementation written in Power Query M, showing how to compute cyclic redundancy checks entirely within a data-transformation language. It displays both the algorithm’s core logic and its practical output as a hexadecimal checksum. The code defines a reverse function for 8-bit and 32-bit values, precomputes a lookup table using a polynomial of 0x4C11DB7, and iterates over input characters with an accumulator function. It relies on Power Query’s `Number.BitwiseAnd`, `Number.BitwiseShiftLeft`, `Number.BitwiseXor`, and `List.Accumulate` APIs. The final result reverses the raw CRC, XORs with 0xFFFFFFFF, and formats it as uppercase hex via `Number.ToText`. The source is a gist by Hugoberry, drawing from external CRC tutorials and bit-hack references.

AI-generated description

Similar vizzes