{"action":"created","issue":{"url":"https://api.github.com/repos/philanc/plc/issues/1","labels_url":"https://api.github.com/repos/philanc/plc/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/philanc/plc/issues/1/comments","events_url":"https://api.github.com/repos/philanc/plc/issues/1/events","html_url":"https://github.com/philanc/plc/issues/1","id":112103661,"number":1,"title":"Chacha20 problem","user":{"login":"janicetr","id":15192336,"avatar_url":"https://avatars.githubusercontent.com/u/15192336?v=3","gravatar_id":"","url":"https://api.github.com/users/janicetr","html_url":"https://github.com/janicetr","followers_url":"https://api.github.com/users/janicetr/followers","following_url":"https://api.github.com/users/janicetr/following{/other_user}","gists_url":"https://api.github.com/users/janicetr/gists{/gist_id}","starred_url":"https://api.github.com/users/janicetr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janicetr/subscriptions","organizations_url":"https://api.github.com/users/janicetr/orgs","repos_url":"https://api.github.com/users/janicetr/repos","events_url":"https://api.github.com/users/janicetr/events{/privacy}","received_events_url":"https://api.github.com/users/janicetr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-19T09:08:55Z","updated_at":"2015-10-19T12:15:42Z","closed_at":"2015-10-19T12:15:42Z","body":"The following snippet reads a file, encrypts and writes it back with .cha20 extension. Given a file for encryption, and the result back again for decryption, the original file content is truncated.\r\n\r\n    chacha20 = require \"chacha20\"\r\n    sha3 = require \"sha3\"\r\n\r\n    f = io.open(arg[1], \"r\")\r\n    plaintext = f:read(\"*all\")\r\n    f:close()\r\n\r\n    key = sha3.hash256(\"Super Password 123 XXX\")\r\n    nonce = \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x4a\\x00\\x00\\x00\\x00\"\r\n    assert(#key == chacha20.key_size)\r\n    assert(#nonce == chacha20.nonce_size)\r\n\r\n    counter = 1\r\n    ciphertext = chacha20.encrypt(key, counter, nonce, plaintext)\r\n\r\n    f = io.open(arg[1] .. \".cha20\", \"w\")\r\n    f:write(ciphertext)\r\n    f:close()\r\n\r\nLICENSE - 1070 bytes\r\nLICENSE.cha20 - 1071 bytes\r\nLICENSE.cha20.cha20 - 234 bytes "},"comment":{"url":"https://api.github.com/repos/philanc/plc/issues/comments/149197717","html_url":"https://github.com/philanc/plc/issues/1#issuecomment-149197717","issue_url":"https://api.github.com/repos/philanc/plc/issues/1","id":149197717,"user":{"login":"janicetr","id":15192336,"avatar_url":"https://avatars.githubusercontent.com/u/15192336?v=3","gravatar_id":"","url":"https://api.github.com/users/janicetr","html_url":"https://github.com/janicetr","followers_url":"https://api.github.com/users/janicetr/followers","following_url":"https://api.github.com/users/janicetr/following{/other_user}","gists_url":"https://api.github.com/users/janicetr/gists{/gist_id}","starred_url":"https://api.github.com/users/janicetr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janicetr/subscriptions","organizations_url":"https://api.github.com/users/janicetr/orgs","repos_url":"https://api.github.com/users/janicetr/repos","events_url":"https://api.github.com/users/janicetr/events{/privacy}","received_events_url":"https://api.github.com/users/janicetr/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T12:15:42Z","updated_at":"2015-10-19T12:15:42Z","body":"Solved."}}