{"action":"created","comment":{"url":"https://api.github.com/repos/nagado/educ/pulls/comments/37453488","id":37453488,"diff_hunk":"@@ -0,0 +1,202 @@\n+#include <iostream>\n+#include <string.h>\n+#include <fstream>\n+#include <ios>\n+#include <random>\n+#include <sstream>\n+\n+\n+//=====put_error=====//\n+void put_error(const std::string& error_message)\n+{\n+  std::cout << error_message;\n+  exit(1);\n+}\n+\n+//=====shuffle=====//\n+\n+void shuffle(std::vector<char>& input)\n+{\n+  std::default_random_engine generator;\n+  std::uniform_int_distribution<int> distribution(0, input.size() - 1);\n+  int i = 0;\n+\n+  for (std::vector<char>::iterator iter = input.begin(); iter < input.end(); ++i, ++iter)\n+  {\n+    int random = distribution(generator);\n+    char tmp = input[i];\n+    input[i] = input[random];\n+    input[random] = tmp;\n+  } \n+}\n+\n+//=====replace_extension=====//\n+std::string replace_extension(const std::string& filename, const std::string& new_extension)\n+{\n+  int i;\n+  std::string new_name;\n+  std::string::const_iterator iter = new_extension.begin();\n+\n+  for (i = 0; filename[i] != '.'; ++i);\n+\n+  ++i;\n+  if (filename[i] == '.')\n+    put_error(\"Oh, snap! Something went wrong.\\n\");\n+\n+  new_name = filename.substr(0, i + 1);\n+\n+  for (int k = 0; iter < new_extension.end(); ++k, ++i, ++iter)\n+    new_name[i] = new_extension[k];\n+\n+  return new_name;\n+}\n+\n+//=====read_file=====//\n+std::vector<char> read_file(const std::string& filename, const std::string error_message, std::streampos& size)\n+{\n+  std::ifstream file (filename, std::ios::in|std::ios::binary|std::ios::ate);\n+  size = file.tellg();\n+  if (!file.is_open())\n+  {\n+    file.close();\n+    put_error(error_message);\n+  }\n+\n+  char inp[(long int)(size)];\n+  file.seekg(0, std::ios::beg);\n+  file.read(inp, size);\n+  file.close();\n+  std::vector<char> input(inp, inp + size);\n+\n+  if (size == 0)\n+    put_error(\"Given file is empty\\n\");\n+\n+  return input;\n+}\n+\n+//=====write_file=====//\n+void write_file(const std::string& filename, std::vector<char> output, const std::string error_message, std::streampos& size)\n+{\n+  std::ofstream file (filename, std::ios::out|std::ios::binary|std::ios::trunc);\n+  if (!file.is_open())\n+  {","path":"encrypter.cpp","position":82,"original_position":82,"commit_id":"6678ba23de2db9173433fb9d06f57d13c0789345","original_commit_id":"6678ba23de2db9173433fb9d06f57d13c0789345","user":{"login":"dlazarus","id":6580913,"avatar_url":"https://avatars.githubusercontent.com/u/6580913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlazarus","html_url":"https://github.com/dlazarus","followers_url":"https://api.github.com/users/dlazarus/followers","following_url":"https://api.github.com/users/dlazarus/following{/other_user}","gists_url":"https://api.github.com/users/dlazarus/gists{/gist_id}","starred_url":"https://api.github.com/users/dlazarus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlazarus/subscriptions","organizations_url":"https://api.github.com/users/dlazarus/orgs","repos_url":"https://api.github.com/users/dlazarus/repos","events_url":"https://api.github.com/users/dlazarus/events{/privacy}","received_events_url":"https://api.github.com/users/dlazarus/received_events","type":"User","site_admin":false},"body":"One statement within \"if\" doesn't need {} around it.","created_at":"2015-08-19T18:56:54Z","updated_at":"2015-08-19T18:56:54Z","html_url":"https://github.com/nagado/educ/pull/1#discussion_r37453488","pull_request_url":"https://api.github.com/repos/nagado/educ/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/nagado/educ/pulls/comments/37453488"},"html":{"href":"https://github.com/nagado/educ/pull/1#discussion_r37453488"},"pull_request":{"href":"https://api.github.com/repos/nagado/educ/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/nagado/educ/pulls/1","id":42355184,"html_url":"https://github.com/nagado/educ/pull/1","diff_url":"https://github.com/nagado/educ/pull/1.diff","patch_url":"https://github.com/nagado/educ/pull/1.patch","issue_url":"https://api.github.com/repos/nagado/educ/issues/1","number":1,"state":"open","locked":false,"title":"first version of encrypter","user":{"login":"dlazarus","id":6580913,"avatar_url":"https://avatars.githubusercontent.com/u/6580913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlazarus","html_url":"https://github.com/dlazarus","followers_url":"https://api.github.com/users/dlazarus/followers","following_url":"https://api.github.com/users/dlazarus/following{/other_user}","gists_url":"https://api.github.com/users/dlazarus/gists{/gist_id}","starred_url":"https://api.github.com/users/dlazarus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlazarus/subscriptions","organizations_url":"https://api.github.com/users/dlazarus/orgs","repos_url":"https://api.github.com/users/dlazarus/repos","events_url":"https://api.github.com/users/dlazarus/events{/privacy}","received_events_url":"https://api.github.com/users/dlazarus/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-13T14:16:19Z","updated_at":"2015-08-19T18:56:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aeafa7299ca46ab009ffedbb0ba2147c3ffad088","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nagado/educ/pulls/1/commits","review_comments_url":"https://api.github.com/repos/nagado/educ/pulls/1/comments","review_comment_url":"https://api.github.com/repos/nagado/educ/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nagado/educ/issues/1/comments","statuses_url":"https://api.github.com/repos/nagado/educ/statuses/6678ba23de2db9173433fb9d06f57d13c0789345","head":{"label":"nagado:encrypter","ref":"encrypter","sha":"6678ba23de2db9173433fb9d06f57d13c0789345","user":{"login":"nagado","id":6580926,"avatar_url":"https://avatars.githubusercontent.com/u/6580926?v=3","gravatar_id":"","url":"https://api.github.com/users/nagado","html_url":"https://github.com/nagado","followers_url":"https://api.github.com/users/nagado/followers","following_url":"https://api.github.com/users/nagado/following{/other_user}","gists_url":"https://api.github.com/users/nagado/gists{/gist_id}","starred_url":"https://api.github.com/users/nagado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagado/subscriptions","organizations_url":"https://api.github.com/users/nagado/orgs","repos_url":"https://api.github.com/users/nagado/repos","events_url":"https://api.github.com/users/nagado/events{/privacy}","received_events_url":"https://api.github.com/users/nagado/received_events","type":"User","site_admin":false},"repo":{"id":40633521,"name":"educ","full_name":"nagado/educ","owner":{"login":"nagado","id":6580926,"avatar_url":"https://avatars.githubusercontent.com/u/6580926?v=3","gravatar_id":"","url":"https://api.github.com/users/nagado","html_url":"https://github.com/nagado","followers_url":"https://api.github.com/users/nagado/followers","following_url":"https://api.github.com/users/nagado/following{/other_user}","gists_url":"https://api.github.com/users/nagado/gists{/gist_id}","starred_url":"https://api.github.com/users/nagado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagado/subscriptions","organizations_url":"https://api.github.com/users/nagado/orgs","repos_url":"https://api.github.com/users/nagado/repos","events_url":"https://api.github.com/users/nagado/events{/privacy}","received_events_url":"https://api.github.com/users/nagado/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nagado/educ","description":"","fork":false,"url":"https://api.github.com/repos/nagado/educ","forks_url":"https://api.github.com/repos/nagado/educ/forks","keys_url":"https://api.github.com/repos/nagado/educ/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nagado/educ/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nagado/educ/teams","hooks_url":"https://api.github.com/repos/nagado/educ/hooks","issue_events_url":"https://api.github.com/repos/nagado/educ/issues/events{/number}","events_url":"https://api.github.com/repos/nagado/educ/events","assignees_url":"https://api.github.com/repos/nagado/educ/assignees{/user}","branches_url":"https://api.github.com/repos/nagado/educ/branches{/branch}","tags_url":"https://api.github.com/repos/nagado/educ/tags","blobs_url":"https://api.github.com/repos/nagado/educ/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nagado/educ/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nagado/educ/git/refs{/sha}","trees_url":"https://api.github.com/repos/nagado/educ/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nagado/educ/statuses/{sha}","languages_url":"https://api.github.com/repos/nagado/educ/languages","stargazers_url":"https://api.github.com/repos/nagado/educ/stargazers","contributors_url":"https://api.github.com/repos/nagado/educ/contributors","subscribers_url":"https://api.github.com/repos/nagado/educ/subscribers","subscription_url":"https://api.github.com/repos/nagado/educ/subscription","commits_url":"https://api.github.com/repos/nagado/educ/commits{/sha}","git_commits_url":"https://api.github.com/repos/nagado/educ/git/commits{/sha}","comments_url":"https://api.github.com/repos/nagado/educ/comments{/number}","issue_comment_url":"https://api.github.com/repos/nagado/educ/issues/comments{/number}","contents_url":"https://api.github.com/repos/nagado/educ/contents/{+path}","compare_url":"https://api.github.com/repos/nagado/educ/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nagado/educ/merges","archive_url":"https://api.github.com/repos/nagado/educ/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nagado/educ/downloads","issues_url":"https://api.github.com/repos/nagado/educ/issues{/number}","pulls_url":"https://api.github.com/repos/nagado/educ/pulls{/number}","milestones_url":"https://api.github.com/repos/nagado/educ/milestones{/number}","notifications_url":"https://api.github.com/repos/nagado/educ/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nagado/educ/labels{/name}","releases_url":"https://api.github.com/repos/nagado/educ/releases{/id}","created_at":"2015-08-13T01:52:34Z","updated_at":"2015-08-13T01:52:34Z","pushed_at":"2015-08-18T18:19:49Z","git_url":"git://github.com/nagado/educ.git","ssh_url":"git@github.com:nagado/educ.git","clone_url":"https://github.com/nagado/educ.git","svn_url":"https://github.com/nagado/educ","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"nagado:master","ref":"master","sha":"d8368f5339e468bf25406041bbff90aee8873dc9","user":{"login":"nagado","id":6580926,"avatar_url":"https://avatars.githubusercontent.com/u/6580926?v=3","gravatar_id":"","url":"https://api.github.com/users/nagado","html_url":"https://github.com/nagado","followers_url":"https://api.github.com/users/nagado/followers","following_url":"https://api.github.com/users/nagado/following{/other_user}","gists_url":"https://api.github.com/users/nagado/gists{/gist_id}","starred_url":"https://api.github.com/users/nagado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagado/subscriptions","organizations_url":"https://api.github.com/users/nagado/orgs","repos_url":"https://api.github.com/users/nagado/repos","events_url":"https://api.github.com/users/nagado/events{/privacy}","received_events_url":"https://api.github.com/users/nagado/received_events","type":"User","site_admin":false},"repo":{"id":40633521,"name":"educ","full_name":"nagado/educ","owner":{"login":"nagado","id":6580926,"avatar_url":"https://avatars.githubusercontent.com/u/6580926?v=3","gravatar_id":"","url":"https://api.github.com/users/nagado","html_url":"https://github.com/nagado","followers_url":"https://api.github.com/users/nagado/followers","following_url":"https://api.github.com/users/nagado/following{/other_user}","gists_url":"https://api.github.com/users/nagado/gists{/gist_id}","starred_url":"https://api.github.com/users/nagado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagado/subscriptions","organizations_url":"https://api.github.com/users/nagado/orgs","repos_url":"https://api.github.com/users/nagado/repos","events_url":"https://api.github.com/users/nagado/events{/privacy}","received_events_url":"https://api.github.com/users/nagado/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nagado/educ","description":"","fork":false,"url":"https://api.github.com/repos/nagado/educ","forks_url":"https://api.github.com/repos/nagado/educ/forks","keys_url":"https://api.github.com/repos/nagado/educ/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nagado/educ/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nagado/educ/teams","hooks_url":"https://api.github.com/repos/nagado/educ/hooks","issue_events_url":"https://api.github.com/repos/nagado/educ/issues/events{/number}","events_url":"https://api.github.com/repos/nagado/educ/events","assignees_url":"https://api.github.com/repos/nagado/educ/assignees{/user}","branches_url":"https://api.github.com/repos/nagado/educ/branches{/branch}","tags_url":"https://api.github.com/repos/nagado/educ/tags","blobs_url":"https://api.github.com/repos/nagado/educ/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nagado/educ/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nagado/educ/git/refs{/sha}","trees_url":"https://api.github.com/repos/nagado/educ/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nagado/educ/statuses/{sha}","languages_url":"https://api.github.com/repos/nagado/educ/languages","stargazers_url":"https://api.github.com/repos/nagado/educ/stargazers","contributors_url":"https://api.github.com/repos/nagado/educ/contributors","subscribers_url":"https://api.github.com/repos/nagado/educ/subscribers","subscription_url":"https://api.github.com/repos/nagado/educ/subscription","commits_url":"https://api.github.com/repos/nagado/educ/commits{/sha}","git_commits_url":"https://api.github.com/repos/nagado/educ/git/commits{/sha}","comments_url":"https://api.github.com/repos/nagado/educ/comments{/number}","issue_comment_url":"https://api.github.com/repos/nagado/educ/issues/comments{/number}","contents_url":"https://api.github.com/repos/nagado/educ/contents/{+path}","compare_url":"https://api.github.com/repos/nagado/educ/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nagado/educ/merges","archive_url":"https://api.github.com/repos/nagado/educ/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nagado/educ/downloads","issues_url":"https://api.github.com/repos/nagado/educ/issues{/number}","pulls_url":"https://api.github.com/repos/nagado/educ/pulls{/number}","milestones_url":"https://api.github.com/repos/nagado/educ/milestones{/number}","notifications_url":"https://api.github.com/repos/nagado/educ/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nagado/educ/labels{/name}","releases_url":"https://api.github.com/repos/nagado/educ/releases{/id}","created_at":"2015-08-13T01:52:34Z","updated_at":"2015-08-13T01:52:34Z","pushed_at":"2015-08-18T18:19:49Z","git_url":"git://github.com/nagado/educ.git","ssh_url":"git@github.com:nagado/educ.git","clone_url":"https://github.com/nagado/educ.git","svn_url":"https://github.com/nagado/educ","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nagado/educ/pulls/1"},"html":{"href":"https://github.com/nagado/educ/pull/1"},"issue":{"href":"https://api.github.com/repos/nagado/educ/issues/1"},"comments":{"href":"https://api.github.com/repos/nagado/educ/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/nagado/educ/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/nagado/educ/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nagado/educ/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/nagado/educ/statuses/6678ba23de2db9173433fb9d06f57d13c0789345"}}}}