# How to use CRC structs in \`std.hash\`?

**URL:** <https://ziggit.dev/t/how-to-use-crc-structs-in-std-hash/16932>\
**Category:** Help\
**Tags:** language\
**Created:** [July 26, 2026, 4:33am UTC](https://ziggit.dev/t/how-to-use-crc-structs-in-std-hash/16932 "2026-07-26T04:33:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeeves](https://ziggit.dev/user_avatar/ziggit.dev/jeeves/32/4585_2.png) [@jeeves](https://ziggit.dev/u/jeeves)\
**Post date:** [July 26, 2026, 4:33am UTC](https://ziggit.dev/t/how-to-use-crc-structs-in-std-hash/16932/1 "2026-07-26T04:33:53Z")

</div>

I noticed that in the source code for zig that there are some predefined CRC structs in (zig/lib/std/hash/crc.zig). I wrote a small test program to try to use them, but they don’t seem to be available in the way that I was expecting.

Compiling with 0.17.0-dev.1426+58a94eaae. I don’t really care about GSM, just an example.

```zig
const std = @import("std");

pub fn main() void {
    const data = "Hello, GSM!";
    const result = std.hash.Crc3Gsm.hash(data);
    std.debug.print("CRC-3 GSM: {x}\n", .{result});
}

```

```zig
test.zig:5:29: error: root source file struct 'hash' has no member named 'Crc3Gsm'
    const result = std.hash.Crc3Gsm.hash(data);

```

---

<div class="post-metadata">

**Author:** ![rosew0od](https://ziggit.dev/user_avatar/ziggit.dev/rosew0od/32/7663_2.png) [@rosew0od](https://ziggit.dev/u/rosew0od)\
**Post date:** [July 26, 2026, 4:50am UTC](https://ziggit.dev/t/how-to-use-crc-structs-in-std-hash/16932/2 "2026-07-26T04:50:45Z")

</div>

Use `std.hash.crc.@"CRC-3/GSM"`.

---

<div class="post-metadata">

**Author:** ![ForeverZer0](https://ziggit.dev/user_avatar/ziggit.dev/foreverzer0/32/2443_2.png) [@ForeverZer0](https://ziggit.dev/u/ForeverZer0)\
**Post date:** [July 26, 2026, 5:04am UTC](https://ziggit.dev/t/how-to-use-crc-structs-in-std-hash/16932/3 "2026-07-26T05:04:38Z")

</div>

The name string identifier syntax. As @rosew0od noted, you must reference it in quotations with `@` prefix, e.g. `@"identifier with spaces or other non-standard characters"`.

> **[String Identifier Syntax - Documentation - The Zig Programming Language](https://ziglang.org/documentation/master/#String-Identifier-Syntax)**
>
> Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

---

<div class="post-metadata">

**Author:** ![jeeves](https://ziggit.dev/user_avatar/ziggit.dev/jeeves/32/4585_2.png) [@jeeves](https://ziggit.dev/u/jeeves)\
**Post date:** [July 26, 2026, 12:37pm UTC](https://ziggit.dev/t/how-to-use-crc-structs-in-std-hash/16932/4 "2026-07-26T12:37:22Z")

</div>

Ok, trying to understand how that trick works.  
I did a search for “CRC-3/GSM” in the source, and it only shows up as a test label in zig/lib/std/hash/crc/test.zig. Where in the codebase does “CRC-3/GSM” get attached to that particular struct?

NM, I think it is “zig/tools/crc/catalog.txt” … and something must process that file.

---

<div class="post-metadata">

**Author:** ![ForeverZer0](https://ziggit.dev/user_avatar/ziggit.dev/foreverzer0/32/2443_2.png) [@ForeverZer0](https://ziggit.dev/u/ForeverZer0)\
**Post date:** [July 26, 2026, 5:05pm UTC](https://ziggit.dev/t/how-to-use-crc-structs-in-std-hash/16932/5 "2026-07-26T17:05:35Z")

</div>

It is in defined in the source code, specifically in [`std.hash.crc.zig`](https://codeberg.org/ziglang/zig/src/branch/master/lib/std/hash/crc.zig). It happens to be the first thing defined in the file.

Guessing by Andrew’s latest commit message of “restore auto-generated status”, I assume the file is indeed generated at some point, though I haven’t spent any time investigating.
