Skip to content

runtime: Extend Go's map crypto hash guarentee to all platforms in 1.5 #9365

Closed
@tildeleb

Description

@tildeleb

I originally wrote this as a response to #9295 but then realized that issue is closed and a patch is pending.
Also see OneOfOne/xxhash#2

It would be much better to extend Go's map crypto hash guarentee to all platforms.

With all due respect I think the proposed new fallback hash function is a mistake. Seriously, I was about to make a "Merry Christmas" post on go-nuts thanking the Go Authors for using a crypto quality hash to implement maps on X86-64. As many other languages struggle with their hash functions being hacked with differential crypto, Go is in much better shape.

My proposal is SipHash.
https://131002.net/siphash/

On that page note "C++ program to find universal (key-independent) multicollisions for CityHash64"
Run the program and see how trivial it is to generate multi collisions.

I wonder how many users have Go programs and APIs that accept uncontrolled input over the web and pump that into a map? The Go team has an opportunity here to protect users from themselves starting with 1.5.

There is already an X86_64 optimized version of SipHash here and it's in the "public domain".
https://github.com/dchest/siphash

I'll try to post some numbers in a few days showing that SipHash could be a viable replacement for the fallback hash.

FWIW, I am working on Go project to offer a large number of hash functions along with testing and benchmarking under one project here:
https://github.com/tildeleb/hashland

I took SMHasher and aeshash code from the Go runtime. There is also a proposal for a new, non streaming hash interface, and more. It's still in pretty rough shape, as I've been hacking on it every day. The benchmarking that it does is currently kind of broken and suffers from using an generic adapter function. I am working on that.

I really hope Go 1.5 can extend map's crypto guarentee to all platforms.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions