{"action":"created","issue":{"url":"https://api.github.com/repos/DaGenix/rust-crypto/issues/310","labels_url":"https://api.github.com/repos/DaGenix/rust-crypto/issues/310/labels{/name}","comments_url":"https://api.github.com/repos/DaGenix/rust-crypto/issues/310/comments","events_url":"https://api.github.com/repos/DaGenix/rust-crypto/issues/310/events","html_url":"https://github.com/DaGenix/rust-crypto/issues/310","id":93708128,"number":310,"title":"Processing input by parts","user":{"login":"DoumanAsh","id":5676053,"avatar_url":"https://avatars.githubusercontent.com/u/5676053?v=3","gravatar_id":"","url":"https://api.github.com/users/DoumanAsh","html_url":"https://github.com/DoumanAsh","followers_url":"https://api.github.com/users/DoumanAsh/followers","following_url":"https://api.github.com/users/DoumanAsh/following{/other_user}","gists_url":"https://api.github.com/users/DoumanAsh/gists{/gist_id}","starred_url":"https://api.github.com/users/DoumanAsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoumanAsh/subscriptions","organizations_url":"https://api.github.com/users/DoumanAsh/orgs","repos_url":"https://api.github.com/users/DoumanAsh/repos","events_url":"https://api.github.com/users/DoumanAsh/events{/privacy}","received_events_url":"https://api.github.com/users/DoumanAsh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-08T06:29:32Z","updated_at":"2015-07-09T18:33:36Z","closed_at":"2015-07-09T18:33:36Z","body":"Is it possible to to proceed content by parts?\r\nFor example if file is too big to load it into memory, it would be more preferably to proceed it by chunks.\r\nBut it seems as of current it is not possible. At least in my experiment generated hash is not correct(and not the same) comparing to the one generated by inputting the whole file.\r\nIt is also strange because, as i see in Md5 struct, flag ```finished``` should be set only when i call result_str()\r\nAnd i think a similar logic should be applied to all other hash algorithms\r\n\r\nJust example of what i'm trying\r\n```\r\nfn calc_checksum(path: &str) {\r\n    if let Ok(file) = std::fs::File::open(&path) {\r\n        let mut file = BufReader::new(file);\r\n        let mut file_content: [u8; 10000] = [0; 10000];\r\n        let mut md5_sum = Md5::new();\r\n        let mut sha1_sum = Sha1::new();\r\n        let mut sha256_sum = Sha256::new();\r\n        let mut sha512_sum = Sha512::new();\r\n\r\n        println!(\">>>{}:\", &path);\r\n        loop {\r\n            let read_bytes = file.read(&mut file_content).unwrap();\r\n            println!(\"read {} bytes\", read_bytes);\r\n            if read_bytes == 0 { break; }\r\n\r\n            md5_sum.input(&file_content);\r\n            sha1_sum.input(&file_content);\r\n            sha256_sum.input(&file_content);\r\n            sha512_sum.input(&file_content);\r\n        }\r\n        println!(\"MD5:   {}\", md5_sum.result_str());\r\n        println!(\"SHA1:  {}\", sha1_sum.result_str());\r\n        println!(\"SHA256:{}\", sha256_sum.result_str());\r\n        println!(\"SHA512:{}\", sha512_sum.result_str());\r\n        println!(\"=======================================================\\n\");\r\n    }\r\n    else {\r\n        println!(\">>>{}: failed to open\", &path);\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/DaGenix/rust-crypto/issues/comments/120097573","html_url":"https://github.com/DaGenix/rust-crypto/issues/310#issuecomment-120097573","issue_url":"https://api.github.com/repos/DaGenix/rust-crypto/issues/310","id":120097573,"user":{"login":"DoumanAsh","id":5676053,"avatar_url":"https://avatars.githubusercontent.com/u/5676053?v=3","gravatar_id":"","url":"https://api.github.com/users/DoumanAsh","html_url":"https://github.com/DoumanAsh","followers_url":"https://api.github.com/users/DoumanAsh/followers","following_url":"https://api.github.com/users/DoumanAsh/following{/other_user}","gists_url":"https://api.github.com/users/DoumanAsh/gists{/gist_id}","starred_url":"https://api.github.com/users/DoumanAsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoumanAsh/subscriptions","organizations_url":"https://api.github.com/users/DoumanAsh/orgs","repos_url":"https://api.github.com/users/DoumanAsh/repos","events_url":"https://api.github.com/users/DoumanAsh/events{/privacy}","received_events_url":"https://api.github.com/users/DoumanAsh/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T18:33:36Z","updated_at":"2015-07-09T18:33:36Z","body":"Aw... that was very stupid of me... Totally forgot that read is not necessary fills buffer completely.\r\nThank you for correction.\r\nSorry for bother"}}