News for hackers. Stuff that matters.
Re:Git archive generation meets Hyrum's law by astockwell on Thursday February 02, 2023 @09:04PM (#34636252)
Golang does this with hashmaps, it deliberately randomizes the keys’ order so that you can never depend on it. People hated it for a few months, but now it’s just another known idiom.
Re:Git archive generation meets Hyrum's law by cpeterso on Thursday February 02, 2023 @09:48PM (#34636529)
Hyrum’s Law applies, even when you take into account Hyrum’s Law. :)

A story about a Golang program that had assumed map iteration was uniformly random but it’s not, which caused a load balancer to assign work unevenly:

https://dev.to/wallyqs/gos-map-iteration-order-is-not-that-r...

A graph of the map iteration order’s distribution showing that it’s not uniformly random:

https://twitter.com/cafxx/status/1135190309514620928

Re:Git archive generation meets Hyrum's law by akkartik on Thursday February 02, 2023 @11:10PM (#34637053)
Ok, you win, have a favorite.
Re:Git archive generation meets Hyrum's law by 0xjnml on Friday February 03, 2023 @03:41AM (#34638780)
From the language specification: "The iteration order over maps is not specified and is not guaranteed to be the same from one iteration to the next."

There's a long shot between "not specified" and "uniformly random".

Re:Git archive generation meets Hyrum's law by pwdisswordfishc on Friday February 03, 2023 @03:47AM (#34638819)
The joke is that the sort of people who rely on apparent behaviour in practice isn’t the sort that tends to look things up in specifications.
Re:Git archive generation meets Hyrum's law by ilyt on Friday February 03, 2023 @02:43AM (#34638312)
Perl did that too IIRC, although motivation was to avoid predictable hash collisions that might put program into slow path
Re:Git archive generation meets Hyrum's law by usr1106 on Friday February 03, 2023 @03:16AM (#34638603)
Didn't Python introduce that, too, after a high profile DoS CVE around 10 years ago?
Re:Git archive generation meets Hyrum's law by jwilk on Friday February 03, 2023 @03:54AM (#34638870)
Yes.

https://docs.python.org/3/reference/datamodel.html#object.__...

> Changed in version 3.3: Hash randomization is enabled by default.

Re:Git archive generation meets Hyrum's law by ahrzb on Friday February 03, 2023 @03:17PM (#34647130)
That’s mainly for security reasons, mainly preventing Hash DDoS attacks, therefore a requirement.