{"action":"created","issue":{"url":"https://api.github.com/repos/madler/zlib/issues/356","repository_url":"https://api.github.com/repos/madler/zlib","labels_url":"https://api.github.com/repos/madler/zlib/issues/356/labels{/name}","comments_url":"https://api.github.com/repos/madler/zlib/issues/356/comments","events_url":"https://api.github.com/repos/madler/zlib/issues/356/events","html_url":"https://github.com/madler/zlib/issues/356","id":320606941,"number":356,"title":"Calculation of NMAX in Adler32 checksum","user":{"login":"hjred","id":11563941,"avatar_url":"https://avatars3.githubusercontent.com/u/11563941?v=4","gravatar_id":"","url":"https://api.github.com/users/hjred","html_url":"https://github.com/hjred","followers_url":"https://api.github.com/users/hjred/followers","following_url":"https://api.github.com/users/hjred/following{/other_user}","gists_url":"https://api.github.com/users/hjred/gists{/gist_id}","starred_url":"https://api.github.com/users/hjred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjred/subscriptions","organizations_url":"https://api.github.com/users/hjred/orgs","repos_url":"https://api.github.com/users/hjred/repos","events_url":"https://api.github.com/users/hjred/events{/privacy}","received_events_url":"https://api.github.com/users/hjred/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-06T16:30:45Z","updated_at":"2018-05-06T17:31:29Z","closed_at":"2018-05-06T17:27:34Z","author_association":"NONE","body":"Hi there,\r\n\r\ni have a question regarding the value of nmax in the Adler32 checksum. Why is it 5552?\r\nIf i use the basic formulas found on wikipedia for example:\r\n\r\n     A = 1 + D1 + D2 + ... + Dn (mod 65521)\r\n     B = A1 + A2 + ... + An = (1 + D1) + (1 + D1 + D2) + ... + (1 + D1 + D2 + ... + Dn) (mod 65521)\r\n\r\nif i set every value to 255 (for D) and let me calculate max n so B is less than the maximum of uint32 say by wolframalpha\r\nhttp://www.wolframalpha.com/input/?i=(1%2B1*255)%2B(1%2B2*255)%2B(1%2B3*255)%2B...%2B(1%2Bn*255)%3C%3D4294967295\r\n\r\nthe solution is (sqrt(8761733347849) - 257) / 510 for nmax, which is 5803 (rounded).\r\n\r\nI got the same answer (5803) using a little program with 255 as input all the time and checking for the first overflow.\r\n\r\nThanks in advance"},"comment":{"url":"https://api.github.com/repos/madler/zlib/issues/comments/386896419","html_url":"https://github.com/madler/zlib/issues/356#issuecomment-386896419","issue_url":"https://api.github.com/repos/madler/zlib/issues/356","id":386896419,"user":{"login":"hjred","id":11563941,"avatar_url":"https://avatars3.githubusercontent.com/u/11563941?v=4","gravatar_id":"","url":"https://api.github.com/users/hjred","html_url":"https://github.com/hjred","followers_url":"https://api.github.com/users/hjred/followers","following_url":"https://api.github.com/users/hjred/following{/other_user}","gists_url":"https://api.github.com/users/hjred/gists{/gist_id}","starred_url":"https://api.github.com/users/hjred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hjred/subscriptions","organizations_url":"https://api.github.com/users/hjred/orgs","repos_url":"https://api.github.com/users/hjred/repos","events_url":"https://api.github.com/users/hjred/events{/privacy}","received_events_url":"https://api.github.com/users/hjred/received_events","type":"User","site_admin":false},"created_at":"2018-05-06T17:31:29Z","updated_at":"2018-05-06T17:31:29Z","author_association":"NONE","body":"Ah, thanks very much :) i didn't thought about that"}}
{"actor":{"display_login":"hjred"}}