{"action":"created","issue":{"url":"https://api.github.com/repos/mitsuhiko/rust-sha1/issues/4","labels_url":"https://api.github.com/repos/mitsuhiko/rust-sha1/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/mitsuhiko/rust-sha1/issues/4/comments","events_url":"https://api.github.com/repos/mitsuhiko/rust-sha1/issues/4/events","html_url":"https://github.com/mitsuhiko/rust-sha1/pull/4","id":53585564,"number":4,"title":"Update to latest Rust + fix invalid message size calculation in case of multipart message","user":{"login":"kstep","id":28537,"avatar_url":"https://avatars.githubusercontent.com/u/28537?v=3","gravatar_id":"","url":"https://api.github.com/users/kstep","html_url":"https://github.com/kstep","followers_url":"https://api.github.com/users/kstep/followers","following_url":"https://api.github.com/users/kstep/following{/other_user}","gists_url":"https://api.github.com/users/kstep/gists{/gist_id}","starred_url":"https://api.github.com/users/kstep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kstep/subscriptions","organizations_url":"https://api.github.com/users/kstep/orgs","repos_url":"https://api.github.com/users/kstep/repos","events_url":"https://api.github.com/users/kstep/events{/privacy}","received_events_url":"https://api.github.com/users/kstep/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-07T01:12:42Z","updated_at":"2015-01-07T08:48:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mitsuhiko/rust-sha1/pulls/4","html_url":"https://github.com/mitsuhiko/rust-sha1/pull/4","diff_url":"https://github.com/mitsuhiko/rust-sha1/pull/4.diff","patch_url":"https://github.com/mitsuhiko/rust-sha1/pull/4.patch"},"body":"Beside the obvious update to latest Rust, I also added some benchmark test and discovered a nasty bug, which appears if message is feed in parts (i.e. `update()` is called several times).\r\n\r\nThe problem is, you add up message length in chunks, no matter if the chunk is processed immediately (64-byte chunk) or put back for later processing (tail chunks with size less than 64 bytes), but on the next `update()` call you add the same tail length again, as a part of processed chunk, plus more tail length, which will be summed up *again* on yet another `update()` call, etc, etc...\r\n\r\nSo you skew `self.len` size counter further from real message size on each `update()` call. The fix is to add up size only when you process the chunk, and then add tail length on `output()`, which I did.\r\n\r\nAlso I rewrote padding calculation a little to make math behind it more obvious."},"comment":{"url":"https://api.github.com/repos/mitsuhiko/rust-sha1/issues/comments/68993510","html_url":"https://github.com/mitsuhiko/rust-sha1/pull/4#issuecomment-68993510","issue_url":"https://api.github.com/repos/mitsuhiko/rust-sha1/issues/4","id":68993510,"user":{"login":"kstep","id":28537,"avatar_url":"https://avatars.githubusercontent.com/u/28537?v=3","gravatar_id":"","url":"https://api.github.com/users/kstep","html_url":"https://github.com/kstep","followers_url":"https://api.github.com/users/kstep/followers","following_url":"https://api.github.com/users/kstep/following{/other_user}","gists_url":"https://api.github.com/users/kstep/gists{/gist_id}","starred_url":"https://api.github.com/users/kstep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kstep/subscriptions","organizations_url":"https://api.github.com/users/kstep/orgs","repos_url":"https://api.github.com/users/kstep/repos","events_url":"https://api.github.com/users/kstep/events{/privacy}","received_events_url":"https://api.github.com/users/kstep/received_events","type":"User","site_admin":false},"created_at":"2015-01-07T08:48:20Z","updated_at":"2015-01-07T08:48:20Z","body":"Sorry for the question, but you seem to not commit to the rust-sha1 repo for about 2 months already, which is pretty long time for Rust. Have you abandoned the project? If yes, can I take maintainership of it? Thank you."}}