'authstream' renamed to 'ae'
[rofl0r-kripto.git] / test / scrypt.c
blobddaf1a06a77872686d437616067375b1f311e9b7
1 /*
2 * Written in 2013 by Gregor Pintar <grpintar@gmail.com>
4 * To the extent possible under law, the author(s) have dedicated
5 * all copyright and related and neighboring rights to this software
6 * to the public domain worldwide.
7 *
8 * This software is distributed without any warranty.
10 * You should have received a copy of the CC0 Public Domain Dedication.
11 * If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
14 #include <stdint.h>
15 #include <stdio.h>
17 #include <kripto/mac/hmac.h>
18 #include <kripto/hash/sha2_256.h>
19 #include <kripto/scrypt.h>
21 int main(void)
23 const uint8_t out[64] =
25 0x21, 0x01, 0xCB, 0x9B, 0x6A, 0x51, 0x1A, 0xAE,
26 0xAD, 0xDB, 0xBE, 0x09, 0xCF, 0x70, 0xF8, 0x81,
27 0xEC, 0x56, 0x8D, 0x57, 0x4A, 0x2F, 0xFD, 0x4D,
28 0xAB, 0xE5, 0xEE, 0x98, 0x20, 0xAD, 0xAA, 0x47,
29 0x8E, 0x56, 0xFD, 0x8F, 0x4B, 0xA5, 0xD0, 0x9F,
30 0xFA, 0x1C, 0x6D, 0x92, 0x7C, 0x40, 0xF4, 0xC3,
31 0x37, 0x30, 0x40, 0x49, 0xE8, 0xA9, 0x52, 0xFB,
32 0xCB, 0xF4, 0x5C, 0x6F, 0xA7, 0x7A, 0x41, 0xA4
34 uint8_t buf[64];
35 unsigned int i;
37 if(kripto_scrypt
39 kripto_mac_hmac,
40 kripto_hash_sha2_256,
42 1048576,
45 "pleaseletmein",
46 13,
47 "SodiumChloride",
48 14,
49 buf,
53 perror("kripto_scrypt() returned error");
54 return -1;
57 for(i = 0; i < 64; i++) if(buf[i] != out[i])
59 fputs("kripto_scrypt: FAIL\n", stderr);
60 return -1;
63 puts("kripto_scrypt: OK");
64 return 0;