{"action":"closed","issue":{"url":"https://api.github.com/repos/ambv/bitrot/issues/13","labels_url":"https://api.github.com/repos/ambv/bitrot/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/ambv/bitrot/issues/13/comments","events_url":"https://api.github.com/repos/ambv/bitrot/issues/13/events","html_url":"https://github.com/ambv/bitrot/issues/13","id":114691335,"number":13,"title":"Bitrot is not reading full file contents","user":{"login":"Suicidal-Insanity","id":15619535,"avatar_url":"https://avatars.githubusercontent.com/u/15619535?v=3","gravatar_id":"","url":"https://api.github.com/users/Suicidal-Insanity","html_url":"https://github.com/Suicidal-Insanity","followers_url":"https://api.github.com/users/Suicidal-Insanity/followers","following_url":"https://api.github.com/users/Suicidal-Insanity/following{/other_user}","gists_url":"https://api.github.com/users/Suicidal-Insanity/gists{/gist_id}","starred_url":"https://api.github.com/users/Suicidal-Insanity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Suicidal-Insanity/subscriptions","organizations_url":"https://api.github.com/users/Suicidal-Insanity/orgs","repos_url":"https://api.github.com/users/Suicidal-Insanity/repos","events_url":"https://api.github.com/users/Suicidal-Insanity/events{/privacy}","received_events_url":"https://api.github.com/users/Suicidal-Insanity/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-02T21:47:26Z","updated_at":"2015-11-03T00:23:20Z","closed_at":"2015-11-03T00:23:20Z","body":"After trying to figure out why this script was so much faster than expected, I stepped through the code and determined that all files are being opened and read in text mode. This means that the data which is being hashed for any given binary file is randomly truncated after a 0x1A byte, making the entire exercise moot.\r\n\r\nThis may be fixed by changing the open command to use 'rb' mode.\r\n\r\nUnfortunately fixing this means that lots and lots of checksums will become invalid.\r\n\r\nExample with added debug output:\r\n>dir\r\n  39 blah - Copy (2).dat\r\n   3 blah - Copy (3) - Copy.dat\r\n   3 blah - Copy (3).dat\r\n 112 blah - Copy.dat\r\n  11 blah.dat\r\n\r\n> python.exe -m bitrot --verbose\r\n       .\\blah - Copy (2).dat; Length:            0; Checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709\r\n.\\blah - Copy (3) - Copy.dat; Length:            1; Checksum: 5ba93c9db0cff93f52b521d7420e43f6eda2784f\r\n       .\\blah - Copy (3).dat; Length:            1; Checksum: 5ba93c9db0cff93f52b521d7420e43f6eda2784f\r\n           .\\blah - Copy.dat; Length:            0; Checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709\r\n                  .\\blah.dat; Length:           11; Checksum: 3a4d8abb5811f6b58b9755ca65ffc01d38f9153f\r\n\r\nNote multiple duplicate checksums.\r\n\r\nWith binary read mode:\r\n> python.exe -m bitrot --verbose\r\nFile:          .\\blah - Copy (2).dat; Length:           39; Checksum: ddfb5399fc8f39f26e43f7e3807ae919ee88fe59\r\nFile:   .\\blah - Copy (3) - Copy.dat; Length:            3; Checksum: 4684f40f78d7474c93464241cf4a1ccaa012d7d3\r\nFile:          .\\blah - Copy (3).dat; Length:            3; Checksum: edf5298c70ff205a98c17fd199ddd610e9e2c7c6\r\nFile:              .\\blah - Copy.dat; Length:          112; Checksum: 733fdb8b5cc69814ff448b87af8b02681a749907\r\nFile:                     .\\blah.dat; Length:           11; Checksum: 3a4d8abb5811f6b58b9755ca65ffc01d38f9153f\r\n\r\n\r\n\r\n\r\n"}}