de0752318171da717af4ce24d0a2e8626afaeb11
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>
Go Cryptography
This repository holds supplementary Go cryptography libraries.
Download/Install
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.
Report Issues / Send Patches
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.
Description
Mirror of ys-ll/crypto (GitHub), kept for paraterm builds
https://golang.org/x/crypto
8.1 MiB
Languages
Go
88.6%
Assembly
11.1%
C
0.3%