{"action":"created","comment":{"url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/comments/227379366","pull_request_review_id":167404862,"id":227379366,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzM3OTM2Ng==","diff_hunk":"@@ -0,0 +1,78 @@\n+// Copyright 2018 Parity Technologies (UK) Ltd.\n+//\n+// Permission is hereby granted, free of charge, to any person obtaining a\n+// copy of this software and associated documentation files (the \"Software\"),\n+// to deal in the Software without restriction, including without limitation\n+// the rights to use, copy, modify, merge, publish, distribute, sublicense,\n+// and/or sell copies of the Software, and to permit persons to whom the\n+// Software is furnished to do so, subject to the following conditions:\n+//\n+// The above copyright notice and this permission notice shall be included in\n+// all copies or substantial portions of the Software.\n+//\n+// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n+// DEALINGS IN THE SOFTWARE.\n+\n+extern crate libp2p_core;\n+extern crate libp2p_secio;\n+extern crate num_cpus;\n+extern crate rand;\n+\n+use libp2p_core::PeerId;\n+use libp2p_secio::SecioKeyPair;\n+use std::{env, str, thread, time::Duration};\n+\n+fn main() {\n+    let prefix = match env::args().nth(1) {\n+        Some(prefix) => prefix,\n+        None => {\n+            println!(\"Usage: {} <prefix>\", env::args().nth(0).unwrap());\n+            return;\n+        }\n+    };\n+\n+    // The base58 alphabet is not necessarily obvious.\n+    const ALPHABET: &'static [u8] = b\"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\n+    if prefix.as_bytes().iter().any(|c| !ALPHABET.contains(c)) {\n+        println!(\"Prefix {} is not valid base58\", prefix);\n+        return;\n+    }\n+\n+    // Due to the fact that a peer id uses a SHA-256 multihash, it always starts with the\n+    // bytes 0x1220, meaning that only some characters are valid.","path":"misc/peer-id-generator/src/main.rs","position":47,"original_position":47,"commit_id":"3cf0806e91c4523e07576d7ddbdeec13f8a7bfa1","original_commit_id":"3cf0806e91c4523e07576d7ddbdeec13f8a7bfa1","user":{"login":"tomaka","id":1412254,"node_id":"MDQ6VXNlcjE0MTIyNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1412254?v=4","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"body":"Yes","created_at":"2018-10-23T13:04:36Z","updated_at":"2018-10-23T13:04:36Z","html_url":"https://github.com/libp2p/rust-libp2p/pull/583#discussion_r227379366","pull_request_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/583","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/comments/227379366"},"html":{"href":"https://github.com/libp2p/rust-libp2p/pull/583#discussion_r227379366"},"pull_request":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/583"}},"in_reply_to_id":227368083},"pull_request":{"url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/583","id":224965040,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0OTY1MDQw","html_url":"https://github.com/libp2p/rust-libp2p/pull/583","diff_url":"https://github.com/libp2p/rust-libp2p/pull/583.diff","patch_url":"https://github.com/libp2p/rust-libp2p/pull/583.patch","issue_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues/583","number":583,"state":"open","locked":false,"title":"Add a peer id generator","user":{"login":"tomaka","id":1412254,"node_id":"MDQ6VXNlcjE0MTIyNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1412254?v=4","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"body":"Allows generating a peer id that starts with a specific prefix.\r\nUseful for generating for example fancy network keys for bootstrap nodes.","created_at":"2018-10-23T09:35:34Z","updated_at":"2018-10-23T13:04:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c5a544c26f365c33d807c9ea502b0006389ed1f1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/583/commits","review_comments_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/583/comments","review_comment_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues/583/comments","statuses_url":"https://api.github.com/repos/libp2p/rust-libp2p/statuses/3cf0806e91c4523e07576d7ddbdeec13f8a7bfa1","head":{"label":"tomaka:peer-id-generator","ref":"peer-id-generator","sha":"3cf0806e91c4523e07576d7ddbdeec13f8a7bfa1","user":{"login":"tomaka","id":1412254,"node_id":"MDQ6VXNlcjE0MTIyNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1412254?v=4","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"repo":{"id":110135073,"node_id":"MDEwOlJlcG9zaXRvcnkxMTAxMzUwNzM=","name":"libp2p-rs","full_name":"tomaka/libp2p-rs","private":false,"owner":{"login":"tomaka","id":1412254,"node_id":"MDQ6VXNlcjE0MTIyNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1412254?v=4","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"html_url":"https://github.com/tomaka/libp2p-rs","description":"LibP2P networking library written in Rust","fork":true,"url":"https://api.github.com/repos/tomaka/libp2p-rs","forks_url":"https://api.github.com/repos/tomaka/libp2p-rs/forks","keys_url":"https://api.github.com/repos/tomaka/libp2p-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomaka/libp2p-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomaka/libp2p-rs/teams","hooks_url":"https://api.github.com/repos/tomaka/libp2p-rs/hooks","issue_events_url":"https://api.github.com/repos/tomaka/libp2p-rs/issues/events{/number}","events_url":"https://api.github.com/repos/tomaka/libp2p-rs/events","assignees_url":"https://api.github.com/repos/tomaka/libp2p-rs/assignees{/user}","branches_url":"https://api.github.com/repos/tomaka/libp2p-rs/branches{/branch}","tags_url":"https://api.github.com/repos/tomaka/libp2p-rs/tags","blobs_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomaka/libp2p-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/tomaka/libp2p-rs/languages","stargazers_url":"https://api.github.com/repos/tomaka/libp2p-rs/stargazers","contributors_url":"https://api.github.com/repos/tomaka/libp2p-rs/contributors","subscribers_url":"https://api.github.com/repos/tomaka/libp2p-rs/subscribers","subscription_url":"https://api.github.com/repos/tomaka/libp2p-rs/subscription","commits_url":"https://api.github.com/repos/tomaka/libp2p-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomaka/libp2p-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomaka/libp2p-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomaka/libp2p-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomaka/libp2p-rs/contents/{+path}","compare_url":"https://api.github.com/repos/tomaka/libp2p-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomaka/libp2p-rs/merges","archive_url":"https://api.github.com/repos/tomaka/libp2p-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomaka/libp2p-rs/downloads","issues_url":"https://api.github.com/repos/tomaka/libp2p-rs/issues{/number}","pulls_url":"https://api.github.com/repos/tomaka/libp2p-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/tomaka/libp2p-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/tomaka/libp2p-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomaka/libp2p-rs/labels{/name}","releases_url":"https://api.github.com/repos/tomaka/libp2p-rs/releases{/id}","deployments_url":"https://api.github.com/repos/tomaka/libp2p-rs/deployments","created_at":"2017-11-09T15:51:30Z","updated_at":"2018-08-21T14:18:19Z","pushed_at":"2018-10-23T10:07:12Z","git_url":"git://github.com/tomaka/libp2p-rs.git","ssh_url":"git@github.com:tomaka/libp2p-rs.git","clone_url":"https://github.com/tomaka/libp2p-rs.git","svn_url":"https://github.com/tomaka/libp2p-rs","homepage":"","size":2603,"stargazers_count":8,"watchers_count":8,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2,"open_issues":0,"watchers":8,"default_branch":"master"}},"base":{"label":"libp2p:master","ref":"master","sha":"de26ba1d2dea97d94df68138d090888705d8f11d","user":{"login":"libp2p","id":14838238,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODM4MjM4","avatar_url":"https://avatars3.githubusercontent.com/u/14838238?v=4","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"repo":{"id":86106381,"node_id":"MDEwOlJlcG9zaXRvcnk4NjEwNjM4MQ==","name":"rust-libp2p","full_name":"libp2p/rust-libp2p","private":false,"owner":{"login":"libp2p","id":14838238,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODM4MjM4","avatar_url":"https://avatars3.githubusercontent.com/u/14838238?v=4","gravatar_id":"","url":"https://api.github.com/users/libp2p","html_url":"https://github.com/libp2p","followers_url":"https://api.github.com/users/libp2p/followers","following_url":"https://api.github.com/users/libp2p/following{/other_user}","gists_url":"https://api.github.com/users/libp2p/gists{/gist_id}","starred_url":"https://api.github.com/users/libp2p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libp2p/subscriptions","organizations_url":"https://api.github.com/users/libp2p/orgs","repos_url":"https://api.github.com/users/libp2p/repos","events_url":"https://api.github.com/users/libp2p/events{/privacy}","received_events_url":"https://api.github.com/users/libp2p/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/libp2p/rust-libp2p","description":"The Rust Implementation of libp2p networking stack. ","fork":false,"url":"https://api.github.com/repos/libp2p/rust-libp2p","forks_url":"https://api.github.com/repos/libp2p/rust-libp2p/forks","keys_url":"https://api.github.com/repos/libp2p/rust-libp2p/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libp2p/rust-libp2p/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libp2p/rust-libp2p/teams","hooks_url":"https://api.github.com/repos/libp2p/rust-libp2p/hooks","issue_events_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues/events{/number}","events_url":"https://api.github.com/repos/libp2p/rust-libp2p/events","assignees_url":"https://api.github.com/repos/libp2p/rust-libp2p/assignees{/user}","branches_url":"https://api.github.com/repos/libp2p/rust-libp2p/branches{/branch}","tags_url":"https://api.github.com/repos/libp2p/rust-libp2p/tags","blobs_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/refs{/sha}","trees_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libp2p/rust-libp2p/statuses/{sha}","languages_url":"https://api.github.com/repos/libp2p/rust-libp2p/languages","stargazers_url":"https://api.github.com/repos/libp2p/rust-libp2p/stargazers","contributors_url":"https://api.github.com/repos/libp2p/rust-libp2p/contributors","subscribers_url":"https://api.github.com/repos/libp2p/rust-libp2p/subscribers","subscription_url":"https://api.github.com/repos/libp2p/rust-libp2p/subscription","commits_url":"https://api.github.com/repos/libp2p/rust-libp2p/commits{/sha}","git_commits_url":"https://api.github.com/repos/libp2p/rust-libp2p/git/commits{/sha}","comments_url":"https://api.github.com/repos/libp2p/rust-libp2p/comments{/number}","issue_comment_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues/comments{/number}","contents_url":"https://api.github.com/repos/libp2p/rust-libp2p/contents/{+path}","compare_url":"https://api.github.com/repos/libp2p/rust-libp2p/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libp2p/rust-libp2p/merges","archive_url":"https://api.github.com/repos/libp2p/rust-libp2p/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libp2p/rust-libp2p/downloads","issues_url":"https://api.github.com/repos/libp2p/rust-libp2p/issues{/number}","pulls_url":"https://api.github.com/repos/libp2p/rust-libp2p/pulls{/number}","milestones_url":"https://api.github.com/repos/libp2p/rust-libp2p/milestones{/number}","notifications_url":"https://api.github.com/repos/libp2p/rust-libp2p/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libp2p/rust-libp2p/labels{/name}","releases_url":"https://api.github.com/repos/libp2p/rust-libp2p/releases{/id}","deployments_url":"https://api.github.com/repos/libp2p/rust-libp2p/deployments","created_at":"2017-03-24T20:05:11Z","updated_at":"2018-10-23T10:07:12Z","pushed_at":"2018-10-23T12:22:10Z","git_url":"git://github.com/libp2p/rust-libp2p.git","ssh_url":"git@github.com:libp2p/rust-libp2p.git","clone_url":"https://github.com/libp2p/rust-libp2p.git","svn_url":"https://github.com/libp2p/rust-libp2p","homepage":"https://libp2p.io","size":1959,"stargazers_count":484,"watchers_count":484,"language":"Rust","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":73,"mirror_url":null,"archived":false,"open_issues_count":116,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":73,"open_issues":116,"watchers":484,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/583"},"html":{"href":"https://github.com/libp2p/rust-libp2p/pull/583"},"issue":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/issues/583"},"comments":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/issues/583/comments"},"review_comments":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/583/comments"},"review_comment":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/pulls/583/commits"},"statuses":{"href":"https://api.github.com/repos/libp2p/rust-libp2p/statuses/3cf0806e91c4523e07576d7ddbdeec13f8a7bfa1"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"tomaka"}}