{"action":"created","comment":{"url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/comments/198600936","pull_request_review_id":132559675,"id":198600936,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODYwMDkzNg==","diff_hunk":"@@ -242,34 +243,28 @@ impl Bech32 {\n         }\n \n         // Check data payload\n-        let mut data_bytes: Vec<u5> = Vec::new();\n-        for b in raw_data.bytes() {\n-            // Alphanumeric only\n-            if !((b >= b'0' && b <= b'9') || (b >= b'A' && b <= b'Z') || (b >= b'a' && b <= b'z')) {\n-                return Err(Error::InvalidChar(b))\n-            }\n-            // Excludes these characters: [1,b,i,o]\n-            if b == b'1' || b == b'b' || b == b'i' || b == b'o' {\n-                return Err(Error::InvalidChar(b))\n+        let mut data_bytes = raw_data.chars().map(|c| {\n+            // Only check if c is in the ASCII range, all invalid ASCII characters have the value -1\n+            // in CHARSET_REV (which covers the whole ASCII range) and will be filtered out later.\n+            if !c.is_ascii() {\n+                return Err(Error::InvalidChar(c))\n             }\n-            // Lowercase\n-            if b >= b'a' && b <= b'z' {\n+\n+            if c.is_lowercase() {","path":"src/lib.rs","position":42,"original_position":42,"commit_id":"7a8c1d492b8bcea40d044fe54d55dee120973222","original_commit_id":"4929ff4a7b4c1c05b3a212589d68d317e7db96f3","user":{"login":"clarkmoody","id":1562417,"node_id":"MDQ6VXNlcjE1NjI0MTc=","avatar_url":"https://avatars2.githubusercontent.com/u/1562417?v=4","gravatar_id":"","url":"https://api.github.com/users/clarkmoody","html_url":"https://github.com/clarkmoody","followers_url":"https://api.github.com/users/clarkmoody/followers","following_url":"https://api.github.com/users/clarkmoody/following{/other_user}","gists_url":"https://api.github.com/users/clarkmoody/gists{/gist_id}","starred_url":"https://api.github.com/users/clarkmoody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clarkmoody/subscriptions","organizations_url":"https://api.github.com/users/clarkmoody/orgs","repos_url":"https://api.github.com/users/clarkmoody/repos","events_url":"https://api.github.com/users/clarkmoody/events{/privacy}","received_events_url":"https://api.github.com/users/clarkmoody/received_events","type":"User","site_admin":false},"body":"The implementation of `is_lowercase` is:\r\n```rust\r\n    pub fn is_lowercase(self) -> bool {\r\n        match self {\r\n            'a'...'z' => true,\r\n            c if c > '\\x7f' => derived_property::Lowercase(c),\r\n            _ => false,\r\n        }\r\n    }\r\n```\r\nSo for ASCII characters, it should be fairly performant. `is_uppercase` has a similar structure.","created_at":"2018-06-27T18:40:23Z","updated_at":"2018-06-27T18:40:24Z","html_url":"https://github.com/rust-bitcoin/rust-bech32/pull/23#discussion_r198600936","pull_request_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/23","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/comments/198600936"},"html":{"href":"https://github.com/rust-bitcoin/rust-bech32/pull/23#discussion_r198600936"},"pull_request":{"href":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/23"}},"in_reply_to_id":197967445},"pull_request":{"url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/23","id":196775155,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2Nzc1MTU1","html_url":"https://github.com/rust-bitcoin/rust-bech32/pull/23","diff_url":"https://github.com/rust-bitcoin/rust-bech32/pull/23.diff","patch_url":"https://github.com/rust-bitcoin/rust-bech32/pull/23.patch","issue_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/issues/23","number":23,"state":"open","locked":false,"title":"Fix missing range checks","user":{"login":"sgeisler","id":1876998,"node_id":"MDQ6VXNlcjE4NzY5OTg=","avatar_url":"https://avatars3.githubusercontent.com/u/1876998?v=4","gravatar_id":"","url":"https://api.github.com/users/sgeisler","html_url":"https://github.com/sgeisler","followers_url":"https://api.github.com/users/sgeisler/followers","following_url":"https://api.github.com/users/sgeisler/following{/other_user}","gists_url":"https://api.github.com/users/sgeisler/gists{/gist_id}","starred_url":"https://api.github.com/users/sgeisler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgeisler/subscriptions","organizations_url":"https://api.github.com/users/sgeisler/orgs","repos_url":"https://api.github.com/users/sgeisler/repos","events_url":"https://api.github.com/users/sgeisler/events{/privacy}","received_events_url":"https://api.github.com/users/sgeisler/received_events","type":"User","site_admin":false},"body":"Fixes #22. \r\n\r\n## TODO:\r\n\r\n- [x] rewrite `from_str_lenient` to catch all bad characters\r\n- [x] adapt tests that use `Error::InvalidChar` since its signature was updated\r\n- [x] validate that all bad characters are `-1` in `CHARSET_REV`\r\n- [x] write tests to show the bug is fixed\r\n- [x] have a look at the checks for mixed case, they seem overly complicated","created_at":"2018-06-22T15:42:55Z","updated_at":"2018-06-27T18:40:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5779bc7eeefe270b9c7339fdb8c073f3ac819138","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/23/commits","review_comments_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/23/comments","review_comment_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/issues/23/comments","statuses_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/statuses/7a8c1d492b8bcea40d044fe54d55dee120973222","head":{"label":"sgeisler:fix-missing-range-checks","ref":"fix-missing-range-checks","sha":"7a8c1d492b8bcea40d044fe54d55dee120973222","user":{"login":"sgeisler","id":1876998,"node_id":"MDQ6VXNlcjE4NzY5OTg=","avatar_url":"https://avatars3.githubusercontent.com/u/1876998?v=4","gravatar_id":"","url":"https://api.github.com/users/sgeisler","html_url":"https://github.com/sgeisler","followers_url":"https://api.github.com/users/sgeisler/followers","following_url":"https://api.github.com/users/sgeisler/following{/other_user}","gists_url":"https://api.github.com/users/sgeisler/gists{/gist_id}","starred_url":"https://api.github.com/users/sgeisler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgeisler/subscriptions","organizations_url":"https://api.github.com/users/sgeisler/orgs","repos_url":"https://api.github.com/users/sgeisler/repos","events_url":"https://api.github.com/users/sgeisler/events{/privacy}","received_events_url":"https://api.github.com/users/sgeisler/received_events","type":"User","site_admin":false},"repo":{"id":120627562,"node_id":"MDEwOlJlcG9zaXRvcnkxMjA2Mjc1NjI=","name":"rust-bech32","full_name":"sgeisler/rust-bech32","owner":{"login":"sgeisler","id":1876998,"node_id":"MDQ6VXNlcjE4NzY5OTg=","avatar_url":"https://avatars3.githubusercontent.com/u/1876998?v=4","gravatar_id":"","url":"https://api.github.com/users/sgeisler","html_url":"https://github.com/sgeisler","followers_url":"https://api.github.com/users/sgeisler/followers","following_url":"https://api.github.com/users/sgeisler/following{/other_user}","gists_url":"https://api.github.com/users/sgeisler/gists{/gist_id}","starred_url":"https://api.github.com/users/sgeisler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgeisler/subscriptions","organizations_url":"https://api.github.com/users/sgeisler/orgs","repos_url":"https://api.github.com/users/sgeisler/repos","events_url":"https://api.github.com/users/sgeisler/events{/privacy}","received_events_url":"https://api.github.com/users/sgeisler/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sgeisler/rust-bech32","description":"Bech32 format encoding and decoding","fork":true,"url":"https://api.github.com/repos/sgeisler/rust-bech32","forks_url":"https://api.github.com/repos/sgeisler/rust-bech32/forks","keys_url":"https://api.github.com/repos/sgeisler/rust-bech32/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sgeisler/rust-bech32/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sgeisler/rust-bech32/teams","hooks_url":"https://api.github.com/repos/sgeisler/rust-bech32/hooks","issue_events_url":"https://api.github.com/repos/sgeisler/rust-bech32/issues/events{/number}","events_url":"https://api.github.com/repos/sgeisler/rust-bech32/events","assignees_url":"https://api.github.com/repos/sgeisler/rust-bech32/assignees{/user}","branches_url":"https://api.github.com/repos/sgeisler/rust-bech32/branches{/branch}","tags_url":"https://api.github.com/repos/sgeisler/rust-bech32/tags","blobs_url":"https://api.github.com/repos/sgeisler/rust-bech32/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sgeisler/rust-bech32/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sgeisler/rust-bech32/git/refs{/sha}","trees_url":"https://api.github.com/repos/sgeisler/rust-bech32/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sgeisler/rust-bech32/statuses/{sha}","languages_url":"https://api.github.com/repos/sgeisler/rust-bech32/languages","stargazers_url":"https://api.github.com/repos/sgeisler/rust-bech32/stargazers","contributors_url":"https://api.github.com/repos/sgeisler/rust-bech32/contributors","subscribers_url":"https://api.github.com/repos/sgeisler/rust-bech32/subscribers","subscription_url":"https://api.github.com/repos/sgeisler/rust-bech32/subscription","commits_url":"https://api.github.com/repos/sgeisler/rust-bech32/commits{/sha}","git_commits_url":"https://api.github.com/repos/sgeisler/rust-bech32/git/commits{/sha}","comments_url":"https://api.github.com/repos/sgeisler/rust-bech32/comments{/number}","issue_comment_url":"https://api.github.com/repos/sgeisler/rust-bech32/issues/comments{/number}","contents_url":"https://api.github.com/repos/sgeisler/rust-bech32/contents/{+path}","compare_url":"https://api.github.com/repos/sgeisler/rust-bech32/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sgeisler/rust-bech32/merges","archive_url":"https://api.github.com/repos/sgeisler/rust-bech32/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sgeisler/rust-bech32/downloads","issues_url":"https://api.github.com/repos/sgeisler/rust-bech32/issues{/number}","pulls_url":"https://api.github.com/repos/sgeisler/rust-bech32/pulls{/number}","milestones_url":"https://api.github.com/repos/sgeisler/rust-bech32/milestones{/number}","notifications_url":"https://api.github.com/repos/sgeisler/rust-bech32/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sgeisler/rust-bech32/labels{/name}","releases_url":"https://api.github.com/repos/sgeisler/rust-bech32/releases{/id}","deployments_url":"https://api.github.com/repos/sgeisler/rust-bech32/deployments","created_at":"2018-02-07T14:44:57Z","updated_at":"2018-02-07T14:44:59Z","pushed_at":"2018-06-25T23:05:00Z","git_url":"git://github.com/sgeisler/rust-bech32.git","ssh_url":"git@github.com:sgeisler/rust-bech32.git","clone_url":"https://github.com/sgeisler/rust-bech32.git","svn_url":"https://github.com/sgeisler/rust-bech32","homepage":null,"size":52,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-bitcoin:master","ref":"master","sha":"6821943476e5babb67d0e7cdc2ca343ebee6f778","user":{"login":"rust-bitcoin","id":37084147,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3MDg0MTQ3","avatar_url":"https://avatars3.githubusercontent.com/u/37084147?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-bitcoin","html_url":"https://github.com/rust-bitcoin","followers_url":"https://api.github.com/users/rust-bitcoin/followers","following_url":"https://api.github.com/users/rust-bitcoin/following{/other_user}","gists_url":"https://api.github.com/users/rust-bitcoin/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-bitcoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-bitcoin/subscriptions","organizations_url":"https://api.github.com/users/rust-bitcoin/orgs","repos_url":"https://api.github.com/users/rust-bitcoin/repos","events_url":"https://api.github.com/users/rust-bitcoin/events{/privacy}","received_events_url":"https://api.github.com/users/rust-bitcoin/received_events","type":"Organization","site_admin":false},"repo":{"id":90658729,"node_id":"MDEwOlJlcG9zaXRvcnk5MDY1ODcyOQ==","name":"rust-bech32","full_name":"rust-bitcoin/rust-bech32","owner":{"login":"rust-bitcoin","id":37084147,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3MDg0MTQ3","avatar_url":"https://avatars3.githubusercontent.com/u/37084147?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-bitcoin","html_url":"https://github.com/rust-bitcoin","followers_url":"https://api.github.com/users/rust-bitcoin/followers","following_url":"https://api.github.com/users/rust-bitcoin/following{/other_user}","gists_url":"https://api.github.com/users/rust-bitcoin/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-bitcoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-bitcoin/subscriptions","organizations_url":"https://api.github.com/users/rust-bitcoin/orgs","repos_url":"https://api.github.com/users/rust-bitcoin/repos","events_url":"https://api.github.com/users/rust-bitcoin/events{/privacy}","received_events_url":"https://api.github.com/users/rust-bitcoin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-bitcoin/rust-bech32","description":"Bech32 format encoding and decoding","fork":false,"url":"https://api.github.com/repos/rust-bitcoin/rust-bech32","forks_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/forks","keys_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/teams","hooks_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/hooks","issue_events_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/issues/events{/number}","events_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/events","assignees_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/assignees{/user}","branches_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/branches{/branch}","tags_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/tags","blobs_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/languages","stargazers_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/stargazers","contributors_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/contributors","subscribers_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/subscribers","subscription_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/subscription","commits_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/contents/{+path}","compare_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/merges","archive_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/downloads","issues_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/issues{/number}","pulls_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/labels{/name}","releases_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/releases{/id}","deployments_url":"https://api.github.com/repos/rust-bitcoin/rust-bech32/deployments","created_at":"2017-05-08T18:14:43Z","updated_at":"2018-05-18T06:42:39Z","pushed_at":"2018-06-25T23:05:02Z","git_url":"git://github.com/rust-bitcoin/rust-bech32.git","ssh_url":"git@github.com:rust-bitcoin/rust-bech32.git","clone_url":"https://github.com/rust-bitcoin/rust-bech32.git","svn_url":"https://github.com/rust-bitcoin/rust-bech32","homepage":null,"size":43,"stargazers_count":3,"watchers_count":3,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":4,"open_issues":5,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/23"},"html":{"href":"https://github.com/rust-bitcoin/rust-bech32/pull/23"},"issue":{"href":"https://api.github.com/repos/rust-bitcoin/rust-bech32/issues/23"},"comments":{"href":"https://api.github.com/repos/rust-bitcoin/rust-bech32/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-bitcoin/rust-bech32/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/rust-bitcoin/rust-bech32/statuses/7a8c1d492b8bcea40d044fe54d55dee120973222"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"clarkmoody"}}