{"action":"created","issue":{"url":"https://api.github.com/repos/briansmith/ring/issues/156","repository_url":"https://api.github.com/repos/briansmith/ring","labels_url":"https://api.github.com/repos/briansmith/ring/issues/156/labels{/name}","comments_url":"https://api.github.com/repos/briansmith/ring/issues/156/comments","events_url":"https://api.github.com/repos/briansmith/ring/issues/156/events","html_url":"https://github.com/briansmith/ring/pull/156","id":143125660,"number":156,"title":"Rewrite SHA-1 in Rust.","user":{"login":"SimonSapin","id":291359,"avatar_url":"https://avatars.githubusercontent.com/u/291359?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonSapin","html_url":"https://github.com/SimonSapin","followers_url":"https://api.github.com/users/SimonSapin/followers","following_url":"https://api.github.com/users/SimonSapin/following{/other_user}","gists_url":"https://api.github.com/users/SimonSapin/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSapin/subscriptions","organizations_url":"https://api.github.com/users/SimonSapin/orgs","repos_url":"https://api.github.com/users/SimonSapin/repos","events_url":"https://api.github.com/users/SimonSapin/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSapin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-24T02:06:03Z","updated_at":"2016-03-24T02:06:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/briansmith/ring/pulls/156","html_url":"https://github.com/briansmith/ring/pull/156","diff_url":"https://github.com/briansmith/ring/pull/156.diff","patch_url":"https://github.com/briansmith/ring/pull/156.patch"},"body":"Fix #60.\r\n\r\nI found a number of SHA-1 implementations in Rust but none of them were in the public domain or under CC0 or ISC, so I wrote another one based on reading FIPS 180-4.\r\n\r\nAs discussed in #60 this does not optimize for speed but keeps the source code short and simple (for example without manual loop unrolling) as a first approximation of optimizing for machine code size."},"comment":{"url":"https://api.github.com/repos/briansmith/ring/issues/comments/200614796","html_url":"https://github.com/briansmith/ring/pull/156#issuecomment-200614796","issue_url":"https://api.github.com/repos/briansmith/ring/issues/156","id":200614796,"user":{"login":"SimonSapin","id":291359,"avatar_url":"https://avatars.githubusercontent.com/u/291359?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonSapin","html_url":"https://github.com/SimonSapin","followers_url":"https://api.github.com/users/SimonSapin/followers","following_url":"https://api.github.com/users/SimonSapin/following{/other_user}","gists_url":"https://api.github.com/users/SimonSapin/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonSapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonSapin/subscriptions","organizations_url":"https://api.github.com/users/SimonSapin/orgs","repos_url":"https://api.github.com/users/SimonSapin/repos","events_url":"https://api.github.com/users/SimonSapin/events{/privacy}","received_events_url":"https://api.github.com/users/SimonSapin/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T02:06:45Z","updated_at":"2016-03-24T02:06:45Z","body":"I was expecting this to be slower, but I was surprised by how much. `cargo test` before this PR took ~3.5 minutes on my machine (all but 15 seconds spent in `pkbdf2_tests`). It now takes almost 24 minutes.\r\n\r\nI suspect this particular test case:\r\n\r\n```\r\nHash = SHA1\r\nP = \"password\"\r\nS = \"salt\"\r\nc = 16777216\r\nDK = eefe3d61cd4da4e4e9945b3d6ba2158c2634e984\r\n```\r\n\r\nMaybe it’s OK to test fewer than 16 millions iterations? Removing a couple digits from `c` brings the total time under 17 seconds.\r\n\r\nEnabling optimizations for tests also helps a lot. A comment in `Cargo.toml` suggests this is intended, but it isn’t actually done.\r\n\r\nCuriously, optimizations seem to make tests other than `pbkdf2` *slower*…\r\n\r\nAt this point I have no idea what’s going on and it’s way past time for me to got to bed."}}