| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
Hash.CRC16
Calculates 16bit CRC value.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| Hash | 16.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "Hash.CRC16"; InputType; InputData { ; InputEncoding; StartValue; Poly; FinalXOR; ReflectInput; ReflectOutput } ) More
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| InputType | The type of input. Can be Text, Container, Image, Path, PDF, Data, base64 or Hex. |
"Text" | |
| InputData | The actual input data. Text, container or file path. |
"Hello World" | |
| InputEncoding | The text encoding for text input. Parameter is ignored for other cases. |
"UTF-8" | Optional |
| StartValue | The start value for the CRC. Default is 65535. |
65535 | Optional |
| Poly | The polynom to use. Default is 4129 = hex 1021 e.g. * hex 3D65 for DNP, IEC 870, M-BUS, wM-BUS and others * hex 1021 for CCITT, X.25, V.41, HDLC FCS, Bluetooth and others * hex 8005 for IBM, ModBus, USB, Bisync, CRC-16, CRC-16-ANSI and others * hex 8BB7 for SCSI DIF * hex 0589 for DECT Cordeless Telephones * hex A02B for ACARS Aplications |
4129 | Optional |
| FinalXOR | The final XOR. Pass 0 to skip. |
0 | Optional |
| ReflectInput | Whether to flip input bits. Default is 0 to no flip. |
0 | Optional |
| ReflectOutput | Whether to flip output bits. Default is 0 to no flip. |
0 | Optional |
Result
Returns number or error.
Description
Calculates 16bit CRC value.You can fill the parameters to get very different CRC variations.
Examples
Try CRC with CCITT and 0xFFFF as start value:
Let ( [
r = MBS("Hash.CRC16"; "Text"; "123456789"; "UTF-8"; 65535; 4129);
h = MBS("Math.DecToHex"; r)
]; r & " " & h)
Example result: 10673 000029B1
r = MBS("Hash.CRC16"; "Text"; "123456789"; "UTF-8"; 65535; 4129);
h = MBS("Math.DecToHex"; r)
]; r & " " & h)
Example result: 10673 000029B1
Try CRC with CCITT and 0 as start value for XMODEM:
Let ( [
r = MBS("Hash.CRC16"; "Text"; "123456789"; "UTF-8"; 0; 4129);
h = MBS("Math.DecToHex"; r)
]; r & " " & h)
r = MBS("Hash.CRC16"; "Text"; "123456789"; "UTF-8"; 0; 4129);
h = MBS("Math.DecToHex"; r)
]; r & " " & h)
Try CRC with MODBUS:
Let ( [
r = MBS("Hash.CRC16"; "Text"; "123456789"; "UTF-8"; 65535; 40961; 0; 1; 0);
h = MBS("Math.DecToHex"; r)
]; r & " " & h)
// poly is hex A001, which is reflected 8005
r = MBS("Hash.CRC16"; "Text"; "123456789"; "UTF-8"; 65535; 40961; 0; 1; 0);
h = MBS("Math.DecToHex"; r)
]; r & " " & h)
// poly is hex A001, which is reflected 8005
See also
Release notes
- Version 16.0
- Added Hash.CRC16 function.
Blog Entries
This function checks for a license.
Created 28th November 2025, last changed 28th November 2025