Skip to main content
bash TV

Go 1.27's New Hidden Gem: maphash.Hasher

Flo Woelki

668 views27 Nov 2026

YouTube

Generic hashing provides a foundation for more advanced hashing techniques, such as Sets or Bloom Filters. Let's find out why. If you would like to prepare for all the changes in Go 1.27, check out this video: https://youtu.be/RboN0J87NrA 📝 Description Meet `maphash.Hasher[T]`, the small new interface in Go 1.27 that gives generic hashing a shared standard. In this quick tutorial, we build a reusable `Set` on top of it. The same `Set` handles types that Go's built-in map can't use as keys. Here's what you will learn: • Understand what `maphash.Hasher[T]` is, why it works like `io.Reader` for hashing, and why a shared contract matters for custom hash tables, sets, and Bloom filters. • Learn how to build a reusable generic `Set[T]`. It uses seeded hashes and collision buckets, and it never needs to change between use cases. • Write your own hashers with Hash and Equal methods. One handles a struct containing a slice, and another compares strings case-insensitively. • Know the rules for a correct hasher: it must be stateless, and equal values must always produce equal hashes. • Get realistic expectations: you probably won't use this directly yet, but it's worth knowing if you write container libraries. ⏳ Timestamps: 00:00 - Introduction 00:33 - What is it? 02:21 - Use Case 13:48 - Testing 16:17 - Outro 👋 Hey there! If you are new to this channel: Hey 👋 my name is Flo and I am a professional software engineer with a passion for coding in Golang, TypeScript, JavaScript, and Rust. This channel is where I share that passion and dive into the exciting world of software engineering. 📨 Support and Connect! Become a member. https://www.youtube.com/@FloWoelki/membership Discord: https://discord.gg/TnA7drJ X / Twitter: https://x.com/FlorianWoelki LinkedIn: https://www.linkedin.com/in/florian-woelki/ GitHub: https://github.com/FlorianWoelki 📝 Copyright Notice The original Go Gopher was designed by Renée French (Source: https://go.dev/blog/gopher License details: https://creativecommons.org/licenses/by/4.0/). The gopher appearing in this video and thumbnail has been modified from the original design and is based on an illustration from Maria Letta's free-gophers-pack (Source: https://github.com/MariaLetta/free-gophers-pack License: CC0 1.0 Public Domain https://creativecommons.org/publicdomain/zero/1.0/). #go #go127 #sets #generic #hashing #bloom #filters

Join the discussion

Have something to add?

Sign in to reply, follow this thread, and earn XP when your answer helps someone.