{"action":"created","issue":{"url":"https://api.github.com/repos/inejge/pwhash/issues/5","repository_url":"https://api.github.com/repos/inejge/pwhash","labels_url":"https://api.github.com/repos/inejge/pwhash/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/inejge/pwhash/issues/5/comments","events_url":"https://api.github.com/repos/inejge/pwhash/issues/5/events","html_url":"https://github.com/inejge/pwhash/issues/5","id":220667598,"number":5,"title":"Generate different error for Salt problems","user":{"login":"gbip","id":15819864,"avatar_url":"https://avatars0.githubusercontent.com/u/15819864?v=3","gravatar_id":"","url":"https://api.github.com/users/gbip","html_url":"https://github.com/gbip","followers_url":"https://api.github.com/users/gbip/followers","following_url":"https://api.github.com/users/gbip/following{/other_user}","gists_url":"https://api.github.com/users/gbip/gists{/gist_id}","starred_url":"https://api.github.com/users/gbip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbip/subscriptions","organizations_url":"https://api.github.com/users/gbip/orgs","repos_url":"https://api.github.com/users/gbip/repos","events_url":"https://api.github.com/users/gbip/events{/privacy}","received_events_url":"https://api.github.com/users/gbip/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-04-10T14:43:43Z","updated_at":"2017-04-10T20:28:34Z","closed_at":"2017-04-10T20:28:34Z","body":"In the current implementation, it is impossible to know if it is our salt that cause a problem or the password.\r\nMaybe you could add an other error ?\r\n\r\n``` rust\r\npub fn hash_with<'a, IBS>(param: IBS, pass: &str) -> Result<String> where IBS: IntoBcryptSetup<'a> {\r\n    let bs = try!(param.into_bcrypt_setup());\r\n    let cost = if let Some(c) = bs.cost {\r\n\tif c < MIN_COST || c > MAX_COST {\r\n\t    return Err(Error::InvalidRounds);\r\n\t}\r\n\tc\r\n    } else { DEFAULT_COST };\r\n    let variant = if let Some(v) = bs.variant {\r\n\tv\r\n    } else { DEFAULT_VARIANT };\r\n    let mut salt_buf = [0u8; 16];\r\n    if bs.salt.is_some() {\r\n// --------------------- Here --------------------------- \\\\\r\n\ttry!(bcrypt_hash64_decode(bs.salt.unwrap(), &mut salt_buf)); // This raised an EncodingError for me, but I couldn't figure out where is this error coming from.\r\n\\\\ ------------------------------------------------------- //\r\n    } else {\r\n\ttry!(random::gen_salt_bytes(&mut salt_buf));\r\n    }\r\n    do_bcrypt(pass, &salt_buf, cost, variant)\r\n}\r\n```\r\nIn case you want to reproduce this bug, here is the salt : ```svxI11FVz7i+Y9nw11T5/Q==```.\r\nThis salt was generated with [base64::encode](https://crates.io/crates/base64)."},"comment":{"url":"https://api.github.com/repos/inejge/pwhash/issues/comments/293069072","html_url":"https://github.com/inejge/pwhash/issues/5#issuecomment-293069072","issue_url":"https://api.github.com/repos/inejge/pwhash/issues/5","id":293069072,"user":{"login":"inejge","id":1049870,"avatar_url":"https://avatars0.githubusercontent.com/u/1049870?v=3","gravatar_id":"","url":"https://api.github.com/users/inejge","html_url":"https://github.com/inejge","followers_url":"https://api.github.com/users/inejge/followers","following_url":"https://api.github.com/users/inejge/following{/other_user}","gists_url":"https://api.github.com/users/inejge/gists{/gist_id}","starred_url":"https://api.github.com/users/inejge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inejge/subscriptions","organizations_url":"https://api.github.com/users/inejge/orgs","repos_url":"https://api.github.com/users/inejge/repos","events_url":"https://api.github.com/users/inejge/events{/privacy}","received_events_url":"https://api.github.com/users/inejge/received_events","type":"User","site_admin":false},"created_at":"2017-04-10T20:28:34Z","updated_at":"2017-04-10T20:28:34Z","body":"This is not a bug; the salt `svxI11FVz7i+Y9nw11T5/Q==` is indeed invalid for bcrypt, since `+` and `=` are not valid encoding characters for the format. More details in #6."}}
{"actor":{"display_login":"inejge"}}