4 ms·
TLS does this with GREASE (Generate Random Extensions And Sustain Extensibility) - https://www.rfc-editor.org/rfc/rfc8701.html https://www.rfc-editor.org/rfc/rf
by madars 1y ago
TLS does this with GREASE (Generate Random Extensions And Sustain Extensibility) - https://www.rfc-editor.org/rfc/rfc8701.html https://www.rfc-editor.org/rfc/rfc8701.html . HN discussion: https://news.ycombinator.com/item?id=39416277 https://news.ycombinator.com/item?id=39416277 (19 points, 8 comments)
Go's implementation of JSON format for protobufs also does this: https://protobuf.dev/reference/go/faq/#unstable-json https://protobuf.dev/reference/go/faq/#unstable-json
> To avoid giving the illusion that the output is stable, we deliberately introduce minor differences so that byte-for-byte comparisons are likely to fail.
- koito17 1y agoGo also randomizes the iteration of map keys, to emphasize that maps are unordered and code should not rely on insertion order. For demonstration: package main import "fmt" func main() { m := map[string]int{"a": 1, "b": 2, "c": 3} for k, _ := range m { fmt.Println(k) } for k, _ := range m { fmt.Println(k) } } Sample output: c a b a b c Each run may produce different key orders.
- metaltyphoon 1y agoI was under the assumption most languages to this.
- db48x 1y agoVery few do, and only quite modern ones. Although I believe there are hashtable libraries where the iteration order is unspecified but generally consistent, only changing when a resize shuffles the elements into different buckets.