{"action":"created","issue":{"url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/91","repository_url":"https://api.github.com/repos/jedisct1/libsodium-php","labels_url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/91/comments","events_url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/91/events","html_url":"https://github.com/jedisct1/libsodium-php/issues/91","id":146597846,"number":91,"title":"crypto_aead_chacha20poly1305 producing incorrect tag","user":{"login":"JoeAlamo","id":8210662,"avatar_url":"https://avatars.githubusercontent.com/u/8210662?v=3","gravatar_id":"","url":"https://api.github.com/users/JoeAlamo","html_url":"https://github.com/JoeAlamo","followers_url":"https://api.github.com/users/JoeAlamo/followers","following_url":"https://api.github.com/users/JoeAlamo/following{/other_user}","gists_url":"https://api.github.com/users/JoeAlamo/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeAlamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeAlamo/subscriptions","organizations_url":"https://api.github.com/users/JoeAlamo/orgs","repos_url":"https://api.github.com/users/JoeAlamo/repos","events_url":"https://api.github.com/users/JoeAlamo/events{/privacy}","received_events_url":"https://api.github.com/users/JoeAlamo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-07T12:10:15Z","updated_at":"2016-04-07T12:51:50Z","closed_at":null,"body":"Hi there,\r\n\r\nI believe that the crypto_aead_chacha20poly1305_X functions are producing an incorrect tag. My version major is 9, version minor is 1 and version_string is 1.0.8.\r\n\r\nI have ran them against the test vectors in [RFC 7539](https://tools.ietf.org/html/rfc7539#appendix-A.5), and whilst the ciphertext produced is correct the tag is not. I have also ran these test vectors on an [Arduino library ](https://github.com/rweather/arduinolibs/blob/master/libraries/Crypto/ChaChaPoly.cpp) which produce the correct tag ([gist here](https://gist.github.com/JoeAlamo/496f717d118acceb4d6fa15af232fb48)). In both cases, they are using the non-ietf version with the 64bit nonce - which is the one that \\Sodium\\crypto_aead_chacha20poly1305_{encrypt|decrypt} is calling after looking through the source.\r\n\r\nHere is a gist of my test code: [https://gist.github.com/JoeAlamo/b225e7c7736c34424e42f88b63ebb8e4](https://gist.github.com/JoeAlamo/b225e7c7736c34424e42f88b63ebb8e4)\r\n\r\nThe output can be viewed at [http://joekeilty.co.uk/chachapolytest.php](http://joekeilty.co.uk/chachapolytest.php) for your convenience.\r\n\r\nIs there just a dumb mistake I am making here or does there appear to be something wrong?\r\n\r\nI appreciate your time.\r\n\r\nCheers."},"comment":{"url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/comments/206877757","html_url":"https://github.com/jedisct1/libsodium-php/issues/91#issuecomment-206877757","issue_url":"https://api.github.com/repos/jedisct1/libsodium-php/issues/91","id":206877757,"user":{"login":"JoeAlamo","id":8210662,"avatar_url":"https://avatars.githubusercontent.com/u/8210662?v=3","gravatar_id":"","url":"https://api.github.com/users/JoeAlamo","html_url":"https://github.com/JoeAlamo","followers_url":"https://api.github.com/users/JoeAlamo/followers","following_url":"https://api.github.com/users/JoeAlamo/following{/other_user}","gists_url":"https://api.github.com/users/JoeAlamo/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeAlamo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeAlamo/subscriptions","organizations_url":"https://api.github.com/users/JoeAlamo/orgs","repos_url":"https://api.github.com/users/JoeAlamo/repos","events_url":"https://api.github.com/users/JoeAlamo/events{/privacy}","received_events_url":"https://api.github.com/users/JoeAlamo/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T12:51:50Z","updated_at":"2016-04-07T12:51:50Z","body":"Hi @jedisct1 ,\r\n\r\nThat has worked a treat!\r\n\r\nThanks once again for your assistance, it really has been truly invaluable and will greatly help me to complete my dissertation.\r\n"}}