{"action":"created","issue":{"url":"https://api.github.com/repos/dchest/fast-sha256-js/issues/6","repository_url":"https://api.github.com/repos/dchest/fast-sha256-js","labels_url":"https://api.github.com/repos/dchest/fast-sha256-js/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/dchest/fast-sha256-js/issues/6/comments","events_url":"https://api.github.com/repos/dchest/fast-sha256-js/issues/6/events","html_url":"https://github.com/dchest/fast-sha256-js/issues/6","id":297718155,"number":6,"title":"PKBDF2 Doesn't appear to generate exepcted values","user":{"login":"PH0lder","id":5640566,"avatar_url":"https://avatars0.githubusercontent.com/u/5640566?v=4","gravatar_id":"","url":"https://api.github.com/users/PH0lder","html_url":"https://github.com/PH0lder","followers_url":"https://api.github.com/users/PH0lder/followers","following_url":"https://api.github.com/users/PH0lder/following{/other_user}","gists_url":"https://api.github.com/users/PH0lder/gists{/gist_id}","starred_url":"https://api.github.com/users/PH0lder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PH0lder/subscriptions","organizations_url":"https://api.github.com/users/PH0lder/orgs","repos_url":"https://api.github.com/users/PH0lder/repos","events_url":"https://api.github.com/users/PH0lder/events{/privacy}","received_events_url":"https://api.github.com/users/PH0lder/received_events","type":"User","site_admin":false},"labels":[{"id":113292169,"url":"https://api.github.com/repos/dchest/fast-sha256-js/labels/invalid","name":"invalid","color":"e6e6e6","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-16T09:05:08Z","updated_at":"2018-02-16T09:25:35Z","closed_at":"2018-02-16T09:08:11Z","author_association":"NONE","body":"I am trying to get corresponding values between JavaScript code and Java code.  When that didn't happen, I went looking for test vectors, and added this function to my JavaScript, which fails to produce the expected output for the first test vector.\r\n\r\nfunction doTestVectors() {\r\n// Test vectors from https://stackoverflow.com/questions/5130513/pbkdf2-hmac-sha2-test-vectors\r\n  result1   = toHexString(sha256.pbkdf2(\"password\", \"salt\", 1, 32));\r\n  expected1 = \"120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b\";\r\n  if (result1 != expected1)\r\n  {\r\n    alert(\"Test failed. result1=\" + result1);\r\n  }\r\n}\r\n\r\nIt produces:\r\nTest failed. result1=a4a11ce5fbe8f96bf3028035286c2c9274cd4259cbc224e37a73d971923903d3\r\n\r\nPerhaps you could add these known good test vectors to the code and then hopefully also get a match?\r\n"},"comment":{"url":"https://api.github.com/repos/dchest/fast-sha256-js/issues/comments/366184083","html_url":"https://github.com/dchest/fast-sha256-js/issues/6#issuecomment-366184083","issue_url":"https://api.github.com/repos/dchest/fast-sha256-js/issues/6","id":366184083,"user":{"login":"PH0lder","id":5640566,"avatar_url":"https://avatars0.githubusercontent.com/u/5640566?v=4","gravatar_id":"","url":"https://api.github.com/users/PH0lder","html_url":"https://github.com/PH0lder","followers_url":"https://api.github.com/users/PH0lder/followers","following_url":"https://api.github.com/users/PH0lder/following{/other_user}","gists_url":"https://api.github.com/users/PH0lder/gists{/gist_id}","starred_url":"https://api.github.com/users/PH0lder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PH0lder/subscriptions","organizations_url":"https://api.github.com/users/PH0lder/orgs","repos_url":"https://api.github.com/users/PH0lder/repos","events_url":"https://api.github.com/users/PH0lder/events{/privacy}","received_events_url":"https://api.github.com/users/PH0lder/received_events","type":"User","site_admin":false},"created_at":"2018-02-16T09:25:35Z","updated_at":"2018-02-16T09:25:35Z","author_association":"NONE","body":"Fair enough, I didn't see the existing about that before opening mine, and I apologize for my mistake.  Once I changed the code to:\r\nfunction doTestVectors() {\r\n// Test vectors from https://stackoverflow.com/questions/5130513/pbkdf2-hmac-sha2-test-vectors\r\n  result1   = toHexString(sha256.pbkdf2(nacl.util.decodeUTF8(\"password\"), nacl.util.decodeUTF8(\"salt\"), 1, 32));\r\n  expected1 = \"120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b\";\r\n  if (result1 != expected1)\r\n  {\r\n    alert(\"Test failed.  result1=\" + result1 + \"  expected1=\" + expected1);\r\n  }\r\n}\r\n\r\nAfter that change it does indeed return the expected result.\r\n\r\nHowever, since this seems a very easy mistake to make, I would encourage you to simply fail if the inputs are not of the correct type, rather than returning what appears to be correct results that are in fact a lie.  It's never nice to surprise the user with unexpected or undocumented behavior, especially when they naively appear to be doing everything correctly."}}
{"actor":{"display_login":"PH0lder"}}