commit | de0752318171da717af4ce24d0a2e8626afaeb11 | [log] [tgz] |
---|---|---|
author | Adam Langley <agl@golang.org> | Wed Aug 08 09:52:45 2018 -0700 |
committer | Adam Langley <agl@golang.org> | Wed Aug 08 21:18:26 2018 +0000 |
tree | 81cb3ffba606ecc1d12fcb077993d31af92a4106 | |
parent | ff745d0763f824127273eee405c465dfc3254caf [diff] |
chacha20poly1305: add some more XChaCha20-Poly1305 test vectors. These vectors were generated with libsodium to ensure that Go is compatible with that library: #include <stdio.h> #include <sodium.h> #include <stdlib.h> static void hexdump(const uint8_t *in, size_t in_len) { printf("\t\t\""); for (size_t i = 0; i < in_len; i++) { printf("%02x", in[i]); } printf("\",\n"); } int main() { uint8_t nonce[24]; uint8_t key[32]; uint8_t m[64], c[64+16]; uint8_t ad[16]; for (size_t ad_len = 0; ad_len < sizeof(ad); ad_len += 4) { for (size_t m_len = 0; m_len < sizeof(m); m_len += 5) { randombytes(nonce, sizeof(nonce)); randombytes(key, sizeof(key)); randombytes(m, m_len); randombytes(ad, ad_len); unsigned long long c_len = sizeof(c); if (crypto_aead_xchacha20poly1305_ietf_encrypt(c, &c_len, m, m_len, ad, ad_len, NULL, nonce, key)) { abort(); } printf("\t{\n"); hexdump(m, m_len); hexdump(ad, ad_len); hexdump(key, sizeof(key)); hexdump(nonce, sizeof(nonce)); hexdump(c, c_len); printf("\t},\n"); } } return 0; } Change-Id: I4e9e4dc26e0e842c82319829599dbe48c331726f Reviewed-on: https://go-review.googlesource.com/128615 Run-TryBot: Adam Langley <agl@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This repository holds supplementary Go cryptography libraries.
The easiest way to install is to run go get -u golang.org/x/crypto/...
. You can also manually git clone the repository to $GOPATH/src/golang.org/x/crypto
.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the crypto repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/crypto:” in the subject line, so it is easy to find.
Note that contributions to the cryptography package receive additional scrutiny due to their sensitive nature. Patches may take longer than normal to receive feedback.