Blame SOURCES/libsodium-1.0.18/test/default/core1.c

ca16be
ca16be
#define TEST_NAME "core1"
ca16be
#include "cmptest.h"
ca16be
ca16be
static unsigned char shared[32] = { 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d,
ca16be
                                    0xe1, 0x72, 0x8e, 0x3b, 0xf4, 0x80, 0x35,
ca16be
                                    0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47,
ca16be
                                    0xd1, 0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c,
ca16be
                                    0x1e, 0x16, 0x17, 0x42 };
ca16be
ca16be
static unsigned char zero[32];
ca16be
ca16be
static unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
ca16be
                               0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
ca16be
ca16be
static unsigned char firstkey[32];
ca16be
ca16be
int
ca16be
main(void)
ca16be
{
ca16be
    int i;
ca16be
ca16be
    crypto_core_hsalsa20(firstkey, zero, shared, c);
ca16be
    for (i = 0; i < 32; ++i) {
ca16be
        if (i > 0) {
ca16be
            printf(",");
ca16be
        } else {
ca16be
            printf(" ");
ca16be
        }
ca16be
        printf("0x%02x", (unsigned int) firstkey[i]);
ca16be
        if (i % 8 == 7) {
ca16be
            printf("\n");
ca16be
        }
ca16be
    }
ca16be
    assert(crypto_core_hsalsa20_outputbytes() > 0U);
ca16be
    assert(crypto_core_hsalsa20_inputbytes() > 0U);
ca16be
    assert(crypto_core_hsalsa20_keybytes() > 0U);
ca16be
    assert(crypto_core_hsalsa20_constbytes() > 0U);
ca16be
ca16be
    return 0;
ca16be
}