{"action":"created","issue":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/4675","repository_url":"https://api.github.com/repos/crystal-lang/crystal","labels_url":"https://api.github.com/repos/crystal-lang/crystal/issues/4675/labels{/name}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/4675/comments","events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/4675/events","html_url":"https://github.com/crystal-lang/crystal/pull/4675","id":240571573,"number":4675,"title":"change computation of hash value.","user":{"login":"funny-falcon","id":249427,"avatar_url":"https://avatars5.githubusercontent.com/u/249427?v=4","gravatar_id":"","url":"https://api.github.com/users/funny-falcon","html_url":"https://github.com/funny-falcon","followers_url":"https://api.github.com/users/funny-falcon/followers","following_url":"https://api.github.com/users/funny-falcon/following{/other_user}","gists_url":"https://api.github.com/users/funny-falcon/gists{/gist_id}","starred_url":"https://api.github.com/users/funny-falcon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/funny-falcon/subscriptions","organizations_url":"https://api.github.com/users/funny-falcon/orgs","repos_url":"https://api.github.com/users/funny-falcon/repos","events_url":"https://api.github.com/users/funny-falcon/events{/privacy}","received_events_url":"https://api.github.com/users/funny-falcon/received_events","type":"User","site_admin":false},"labels":[{"id":521914109,"url":"https://api.github.com/repos/crystal-lang/crystal/labels/kind:refactor","name":"kind:refactor","color":"c2e0c6","default":false},{"id":514698806,"url":"https://api.github.com/repos/crystal-lang/crystal/labels/pr:needs-review","name":"pr:needs-review","color":"c5def5","default":false},{"id":253019694,"url":"https://api.github.com/repos/crystal-lang/crystal/labels/topic:stdlib","name":"topic:stdlib","color":"fad8c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":37,"created_at":"2017-07-05T08:12:58Z","updated_at":"2017-07-16T00:37:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/4675","html_url":"https://github.com/crystal-lang/crystal/pull/4675","diff_url":"https://github.com/crystal-lang/crystal/pull/4675.diff","patch_url":"https://github.com/crystal-lang/crystal/pull/4675.patch"},"body":"To protect against Hash DoS, change the way hash value is computed.\r\nClass|Struct should define method `def hash(hasher)` and call\r\n`hasher << @ivar` inside.\r\n\r\nAs an option, for speed, and for backward compatibility, `def hash`\r\nstill could be implemented. It will be used for Hash of matched type.\r\n`Thread#hash` and `Signal#hash` is implemented as unseeded cause they are\r\n used before `StdHasher @@seed` is initialized.\r\n\r\nBut it is better to implement `def hash(hasher)`.\r\n\r\nStdHasher is default hasher that uses `hash(hasher)` and it is used as default\r\nseeded hasher. It also implements `unseeded` for `Enums`.\r\n\r\nAlso, number normalization for hashing introduced, ie rule 'equality\r\nforces hash equality' is forced (`a == b` => `a.hash == b.hash`).\r\nNormalization idea is borrowed from Python implementation.\r\n(idea by Akzhan Abdulin @akzhan)\r\n\r\nFixes #4578\r\nPrerequisite for #4557\r\nReplaces #4581"},"comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments/315572946","html_url":"https://github.com/crystal-lang/crystal/pull/4675#issuecomment-315572946","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/4675","id":315572946,"user":{"login":"akzhan","id":112516,"avatar_url":"https://avatars5.githubusercontent.com/u/112516?v=4","gravatar_id":"","url":"https://api.github.com/users/akzhan","html_url":"https://github.com/akzhan","followers_url":"https://api.github.com/users/akzhan/followers","following_url":"https://api.github.com/users/akzhan/following{/other_user}","gists_url":"https://api.github.com/users/akzhan/gists{/gist_id}","starred_url":"https://api.github.com/users/akzhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akzhan/subscriptions","organizations_url":"https://api.github.com/users/akzhan/orgs","repos_url":"https://api.github.com/users/akzhan/repos","events_url":"https://api.github.com/users/akzhan/events{/privacy}","received_events_url":"https://api.github.com/users/akzhan/received_events","type":"User","site_admin":false},"created_at":"2017-07-16T00:37:44Z","updated_at":"2017-07-16T00:37:44Z","body":"custom (lucky777 inspired) algorithm was last that passed the spec"}}
{"actor":{"display_login":"akzhan"}}