{"action":"created","comment":{"url":"https://api.github.com/repos/cryptii/cryptii/pulls/comments/226857471","pull_request_review_id":166778699,"id":226857471,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjg1NzQ3MQ==","diff_hunk":"@@ -0,0 +1,328 @@\n+\n+import Browser from '../Browser'\n+import Chain from '../Chain'\n+import Encoder from '../Encoder'\n+import InvalidInputError from '../Error/InvalidInput'\n+// import md5 from './Hash/md5'\n+import nodeCrypto from 'crypto'\n+\n+const meta = {\n+  name: 'block-cipher',\n+  title: 'Block Cipher',\n+  category: 'Modern cryptography',\n+  type: 'encoder'\n+}\n+\n+const algorithms = [\n+  {\n+    name: 'aes-128',\n+    label: 'AES-128',\n+    blockSize: 128,\n+    keySize: 128,\n+    browserAlgorithm: 'aes',\n+    nodeAlgorithm: 'aes-128'\n+  },\n+  {\n+    name: 'aes-192',\n+    label: 'AES-192',\n+    blockSize: 128,\n+    keySize: 192,\n+    browserAlgorithm: 'aes',\n+    nodeAlgorithm: 'aes-192'\n+  },\n+  {\n+    name: 'aes-256',\n+    label: 'AES-256',\n+    blockSize: 128,\n+    keySize: 256,\n+    browserAlgorithm: 'aes',\n+    nodeAlgorithm: 'aes-256'\n+  }\n+\n+]\n+\n+const modes = [\n+  {\n+    name: 'ecb',\n+    label: 'ECB (Electronic Code Book)',\n+    needsIV: false\n+  },\n+  {\n+    name: 'cbc',\n+    label: 'CBC (Cipher Block Chaining)',\n+    needsIV: true\n+  },\n+  {\n+    name: 'ctr',\n+    label: 'CTR (Counter)',\n+    needsIV: true\n+  }\n+]\n+\n+/**\n+ * Encoder brick for creating message digests\n+ */\n+export default class BlockCipherEncoder extends Encoder {\n+  /**\n+   * Returns brick meta.\n+   * @return {object}\n+   */\n+  static getMeta () {\n+    return meta\n+  }\n+\n+  /**\n+   * Constructor\n+   */\n+  constructor () {\n+    super()\n+\n+    const algorithms = BlockCipherEncoder.filterAvailableAlgorithms()\n+    this.registerSetting([\n+      {\n+        name: 'algorithm',\n+        type: 'enum',\n+        value: 'aes-128',\n+        randomizable: false,\n+        options: {\n+          elements: algorithms.map(algorithm => algorithm.name),\n+          labels: algorithms.map(algorithm => algorithm.label)\n+        }\n+      },\n+      {\n+        name: 'mode',\n+        type: 'enum',\n+        value: 'cbc',\n+        randomizable: false,\n+        options: {\n+          elements: modes.map(algorithm => algorithm.name),\n+          labels: modes.map(algorithm => algorithm.label)\n+        }\n+      },\n+      {\n+        name: 'key',\n+        type: 'bytes',\n+        value: new Uint8Array([\n+          0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,\n+          0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c ]\n+        )\n+      },\n+      {\n+        name: 'iv',\n+        type: 'bytes',\n+        value: new Uint8Array([\n+          0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n+          0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F ]\n+        )\n+      } /*,\n+      {\n+        name: 'pad',\n+        type: 'boolean',\n+        value: false\n+      } */\n+\n+    ])\n+  }\n+\n+  /**\n+   * Triggered when a setting value has changed.\n+   * Override is required to call super.\n+   * @protected\n+   * @param {Setting} setting\n+   * @param {mixed} value Setting value\n+   */\n+  settingValueDidChange (setting, value) {\n+    super.settingValueDidChange(setting, value)\n+\n+    if (setting.getName() === 'mode') {\n+      let ivSetting = this.getSetting('iv')\n+      const isVisible = (value !== 'ecb')\n+      ivSetting && ivSetting.setVisible(isVisible)","path":"src/Encoder/BlockCipher.js","position":140,"original_position":140,"commit_id":"638c75b47d3a83181557d571375187ba8974573c","original_commit_id":"638c75b47d3a83181557d571375187ba8974573c","user":{"login":"ffraenz","id":1041468,"node_id":"MDQ6VXNlcjEwNDE0Njg=","avatar_url":"https://avatars2.githubusercontent.com/u/1041468?v=4","gravatar_id":"","url":"https://api.github.com/users/ffraenz","html_url":"https://github.com/ffraenz","followers_url":"https://api.github.com/users/ffraenz/followers","following_url":"https://api.github.com/users/ffraenz/following{/other_user}","gists_url":"https://api.github.com/users/ffraenz/gists{/gist_id}","starred_url":"https://api.github.com/users/ffraenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ffraenz/subscriptions","organizations_url":"https://api.github.com/users/ffraenz/orgs","repos_url":"https://api.github.com/users/ffraenz/repos","events_url":"https://api.github.com/users/ffraenz/events{/privacy}","received_events_url":"https://api.github.com/users/ffraenz/received_events","type":"User","site_admin":false},"body":"We can depend on settings registered in the constructor. No need for additional checks.\r\n\r\n```suggestion\r\n      this.getSetting('iv').setVisible(value !== 'ecb')\r\n```","created_at":"2018-10-21T10:44:38Z","updated_at":"2018-10-21T10:58:33Z","html_url":"https://github.com/cryptii/cryptii/pull/31#discussion_r226857471","pull_request_url":"https://api.github.com/repos/cryptii/cryptii/pulls/31","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/cryptii/cryptii/pulls/comments/226857471"},"html":{"href":"https://github.com/cryptii/cryptii/pull/31#discussion_r226857471"},"pull_request":{"href":"https://api.github.com/repos/cryptii/cryptii/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/cryptii/cryptii/pulls/31","id":224505646,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NTA1NjQ2","html_url":"https://github.com/cryptii/cryptii/pull/31","diff_url":"https://github.com/cryptii/cryptii/pull/31.diff","patch_url":"https://github.com/cryptii/cryptii/pull/31.patch","issue_url":"https://api.github.com/repos/cryptii/cryptii/issues/31","number":31,"state":"open","locked":false,"title":"BlockCipher Encoder with initial AES support","user":{"login":"SeanWykes","id":8363933,"node_id":"MDQ6VXNlcjgzNjM5MzM=","avatar_url":"https://avatars1.githubusercontent.com/u/8363933?v=4","gravatar_id":"","url":"https://api.github.com/users/SeanWykes","html_url":"https://github.com/SeanWykes","followers_url":"https://api.github.com/users/SeanWykes/followers","following_url":"https://api.github.com/users/SeanWykes/following{/other_user}","gists_url":"https://api.github.com/users/SeanWykes/gists{/gist_id}","starred_url":"https://api.github.com/users/SeanWykes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeanWykes/subscriptions","organizations_url":"https://api.github.com/users/SeanWykes/orgs","repos_url":"https://api.github.com/users/SeanWykes/repos","events_url":"https://api.github.com/users/SeanWykes/events{/privacy}","received_events_url":"https://api.github.com/users/SeanWykes/received_events","type":"User","site_admin":false},"body":"Fixed base64 extracts from JSON (ByteSetting)\r\n\r\nAdded BlockCipher Encoder with support for AES-128/192/256 support  (ECB, CBC, CTR modes).\r\n\r\n100% pass for node tests.\r\nAs usual, webCrypto has variable support for modes and key-sized (grrrr). May need monkey-patching support for different combinations, but as at some point I intend to add DES as an algorithm, for which webCrypto has no support anyway .. this should/will be automatic","created_at":"2018-10-20T22:39:46Z","updated_at":"2018-10-21T10:58:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3da02577b6917b3652f52d12397e59444f383c9e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cryptii/cryptii/pulls/31/commits","review_comments_url":"https://api.github.com/repos/cryptii/cryptii/pulls/31/comments","review_comment_url":"https://api.github.com/repos/cryptii/cryptii/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cryptii/cryptii/issues/31/comments","statuses_url":"https://api.github.com/repos/cryptii/cryptii/statuses/638c75b47d3a83181557d571375187ba8974573c","head":{"label":"cryptographix:master","ref":"master","sha":"638c75b47d3a83181557d571375187ba8974573c","user":{"login":"cryptographix","id":16575975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NTc1OTc1","avatar_url":"https://avatars2.githubusercontent.com/u/16575975?v=4","gravatar_id":"","url":"https://api.github.com/users/cryptographix","html_url":"https://github.com/cryptographix","followers_url":"https://api.github.com/users/cryptographix/followers","following_url":"https://api.github.com/users/cryptographix/following{/other_user}","gists_url":"https://api.github.com/users/cryptographix/gists{/gist_id}","starred_url":"https://api.github.com/users/cryptographix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cryptographix/subscriptions","organizations_url":"https://api.github.com/users/cryptographix/orgs","repos_url":"https://api.github.com/users/cryptographix/repos","events_url":"https://api.github.com/users/cryptographix/events{/privacy}","received_events_url":"https://api.github.com/users/cryptographix/received_events","type":"Organization","site_admin":false},"repo":{"id":150905807,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA5MDU4MDc=","name":"cryptii","full_name":"cryptographix/cryptii","private":false,"owner":{"login":"cryptographix","id":16575975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NTc1OTc1","avatar_url":"https://avatars2.githubusercontent.com/u/16575975?v=4","gravatar_id":"","url":"https://api.github.com/users/cryptographix","html_url":"https://github.com/cryptographix","followers_url":"https://api.github.com/users/cryptographix/followers","following_url":"https://api.github.com/users/cryptographix/following{/other_user}","gists_url":"https://api.github.com/users/cryptographix/gists{/gist_id}","starred_url":"https://api.github.com/users/cryptographix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cryptographix/subscriptions","organizations_url":"https://api.github.com/users/cryptographix/orgs","repos_url":"https://api.github.com/users/cryptographix/repos","events_url":"https://api.github.com/users/cryptographix/events{/privacy}","received_events_url":"https://api.github.com/users/cryptographix/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/cryptographix/cryptii","description":"Modular online encoding, encryption and conversion tool and framework","fork":true,"url":"https://api.github.com/repos/cryptographix/cryptii","forks_url":"https://api.github.com/repos/cryptographix/cryptii/forks","keys_url":"https://api.github.com/repos/cryptographix/cryptii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cryptographix/cryptii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cryptographix/cryptii/teams","hooks_url":"https://api.github.com/repos/cryptographix/cryptii/hooks","issue_events_url":"https://api.github.com/repos/cryptographix/cryptii/issues/events{/number}","events_url":"https://api.github.com/repos/cryptographix/cryptii/events","assignees_url":"https://api.github.com/repos/cryptographix/cryptii/assignees{/user}","branches_url":"https://api.github.com/repos/cryptographix/cryptii/branches{/branch}","tags_url":"https://api.github.com/repos/cryptographix/cryptii/tags","blobs_url":"https://api.github.com/repos/cryptographix/cryptii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cryptographix/cryptii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cryptographix/cryptii/git/refs{/sha}","trees_url":"https://api.github.com/repos/cryptographix/cryptii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cryptographix/cryptii/statuses/{sha}","languages_url":"https://api.github.com/repos/cryptographix/cryptii/languages","stargazers_url":"https://api.github.com/repos/cryptographix/cryptii/stargazers","contributors_url":"https://api.github.com/repos/cryptographix/cryptii/contributors","subscribers_url":"https://api.github.com/repos/cryptographix/cryptii/subscribers","subscription_url":"https://api.github.com/repos/cryptographix/cryptii/subscription","commits_url":"https://api.github.com/repos/cryptographix/cryptii/commits{/sha}","git_commits_url":"https://api.github.com/repos/cryptographix/cryptii/git/commits{/sha}","comments_url":"https://api.github.com/repos/cryptographix/cryptii/comments{/number}","issue_comment_url":"https://api.github.com/repos/cryptographix/cryptii/issues/comments{/number}","contents_url":"https://api.github.com/repos/cryptographix/cryptii/contents/{+path}","compare_url":"https://api.github.com/repos/cryptographix/cryptii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cryptographix/cryptii/merges","archive_url":"https://api.github.com/repos/cryptographix/cryptii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cryptographix/cryptii/downloads","issues_url":"https://api.github.com/repos/cryptographix/cryptii/issues{/number}","pulls_url":"https://api.github.com/repos/cryptographix/cryptii/pulls{/number}","milestones_url":"https://api.github.com/repos/cryptographix/cryptii/milestones{/number}","notifications_url":"https://api.github.com/repos/cryptographix/cryptii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cryptographix/cryptii/labels{/name}","releases_url":"https://api.github.com/repos/cryptographix/cryptii/releases{/id}","deployments_url":"https://api.github.com/repos/cryptographix/cryptii/deployments","created_at":"2018-09-29T21:51:32Z","updated_at":"2018-10-20T23:20:11Z","pushed_at":"2018-10-20T23:20:09Z","git_url":"git://github.com/cryptographix/cryptii.git","ssh_url":"git@github.com:cryptographix/cryptii.git","clone_url":"https://github.com/cryptographix/cryptii.git","svn_url":"https://github.com/cryptographix/cryptii","homepage":"https://cryptii.com/","size":1159,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"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":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cryptii:master","ref":"master","sha":"cf77b5a20564e1d992d399ec04606180ef52549f","user":{"login":"cryptii","id":9558374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1NTgzNzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/9558374?v=4","gravatar_id":"","url":"https://api.github.com/users/cryptii","html_url":"https://github.com/cryptii","followers_url":"https://api.github.com/users/cryptii/followers","following_url":"https://api.github.com/users/cryptii/following{/other_user}","gists_url":"https://api.github.com/users/cryptii/gists{/gist_id}","starred_url":"https://api.github.com/users/cryptii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cryptii/subscriptions","organizations_url":"https://api.github.com/users/cryptii/orgs","repos_url":"https://api.github.com/users/cryptii/repos","events_url":"https://api.github.com/users/cryptii/events{/privacy}","received_events_url":"https://api.github.com/users/cryptii/received_events","type":"Organization","site_admin":false},"repo":{"id":14086422,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA4NjQyMg==","name":"cryptii","full_name":"cryptii/cryptii","private":false,"owner":{"login":"cryptii","id":9558374,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk1NTgzNzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/9558374?v=4","gravatar_id":"","url":"https://api.github.com/users/cryptii","html_url":"https://github.com/cryptii","followers_url":"https://api.github.com/users/cryptii/followers","following_url":"https://api.github.com/users/cryptii/following{/other_user}","gists_url":"https://api.github.com/users/cryptii/gists{/gist_id}","starred_url":"https://api.github.com/users/cryptii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cryptii/subscriptions","organizations_url":"https://api.github.com/users/cryptii/orgs","repos_url":"https://api.github.com/users/cryptii/repos","events_url":"https://api.github.com/users/cryptii/events{/privacy}","received_events_url":"https://api.github.com/users/cryptii/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/cryptii/cryptii","description":"Modular online encoding, encryption and conversion tool and framework","fork":false,"url":"https://api.github.com/repos/cryptii/cryptii","forks_url":"https://api.github.com/repos/cryptii/cryptii/forks","keys_url":"https://api.github.com/repos/cryptii/cryptii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cryptii/cryptii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cryptii/cryptii/teams","hooks_url":"https://api.github.com/repos/cryptii/cryptii/hooks","issue_events_url":"https://api.github.com/repos/cryptii/cryptii/issues/events{/number}","events_url":"https://api.github.com/repos/cryptii/cryptii/events","assignees_url":"https://api.github.com/repos/cryptii/cryptii/assignees{/user}","branches_url":"https://api.github.com/repos/cryptii/cryptii/branches{/branch}","tags_url":"https://api.github.com/repos/cryptii/cryptii/tags","blobs_url":"https://api.github.com/repos/cryptii/cryptii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cryptii/cryptii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cryptii/cryptii/git/refs{/sha}","trees_url":"https://api.github.com/repos/cryptii/cryptii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cryptii/cryptii/statuses/{sha}","languages_url":"https://api.github.com/repos/cryptii/cryptii/languages","stargazers_url":"https://api.github.com/repos/cryptii/cryptii/stargazers","contributors_url":"https://api.github.com/repos/cryptii/cryptii/contributors","subscribers_url":"https://api.github.com/repos/cryptii/cryptii/subscribers","subscription_url":"https://api.github.com/repos/cryptii/cryptii/subscription","commits_url":"https://api.github.com/repos/cryptii/cryptii/commits{/sha}","git_commits_url":"https://api.github.com/repos/cryptii/cryptii/git/commits{/sha}","comments_url":"https://api.github.com/repos/cryptii/cryptii/comments{/number}","issue_comment_url":"https://api.github.com/repos/cryptii/cryptii/issues/comments{/number}","contents_url":"https://api.github.com/repos/cryptii/cryptii/contents/{+path}","compare_url":"https://api.github.com/repos/cryptii/cryptii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cryptii/cryptii/merges","archive_url":"https://api.github.com/repos/cryptii/cryptii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cryptii/cryptii/downloads","issues_url":"https://api.github.com/repos/cryptii/cryptii/issues{/number}","pulls_url":"https://api.github.com/repos/cryptii/cryptii/pulls{/number}","milestones_url":"https://api.github.com/repos/cryptii/cryptii/milestones{/number}","notifications_url":"https://api.github.com/repos/cryptii/cryptii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cryptii/cryptii/labels{/name}","releases_url":"https://api.github.com/repos/cryptii/cryptii/releases{/id}","deployments_url":"https://api.github.com/repos/cryptii/cryptii/deployments","created_at":"2013-11-03T14:10:46Z","updated_at":"2018-10-20T23:44:43Z","pushed_at":"2018-10-20T23:20:11Z","git_url":"git://github.com/cryptii/cryptii.git","ssh_url":"git@github.com:cryptii/cryptii.git","clone_url":"https://github.com/cryptii/cryptii.git","svn_url":"https://github.com/cryptii/cryptii","homepage":"https://cryptii.com/","size":1137,"stargazers_count":384,"watchers_count":384,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":88,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":88,"open_issues":9,"watchers":384,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cryptii/cryptii/pulls/31"},"html":{"href":"https://github.com/cryptii/cryptii/pull/31"},"issue":{"href":"https://api.github.com/repos/cryptii/cryptii/issues/31"},"comments":{"href":"https://api.github.com/repos/cryptii/cryptii/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/cryptii/cryptii/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/cryptii/cryptii/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cryptii/cryptii/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/cryptii/cryptii/statuses/638c75b47d3a83181557d571375187ba8974573c"}},"author_association":"NONE"}}
{"actor":{"display_login":"ffraenz"}}