FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Modules/_blake2/impl/blake2s-test.c at 3.9 · python-emscripten/cpython · GitHub
python-emscripten
cpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Modules
/
_blake2
/
impl
/
blake2s-test.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (34 loc) · 1.14 KB
Breadcrumbs
cpython
/
Modules
/
_blake2
/
impl
/
blake2s-test.c
Copy path
File metadata and controls
43 lines (34 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
BLAKE2 reference source code package - optimized C implementations
Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#include
<stdio.h>
#include
<string.h>
#include
"blake2.h"
#include
"blake2-kat.h"
int
main
(
int
argc
,
char
*
*
argv
)
{
uint8_t
key
[
BLAKE2S_KEYBYTES
];
uint8_t
buf
[
KAT_LENGTH
];
for
(
size_t
i
=
0
;
i
<
BLAKE2S_KEYBYTES
;
++
i
)
key
[
i
]
=
(
uint8_t
)
i
;
for
(
size_t
i
=
0
;
i
<
KAT_LENGTH
;
++
i
)
buf
[
i
]
=
(
uint8_t
)
i
;
for
(
size_t
i
=
0
;
i
<
KAT_LENGTH
;
++
i
)
{
uint8_t
hash
[
BLAKE2S_OUTBYTES
];
if
(
blake2s
(
hash
,
buf
,
key
,
BLAKE2S_OUTBYTES
,
i
,
BLAKE2S_KEYBYTES
)
<
0
||
0
!=
memcmp
(
hash
,
blake2s_keyed_kat
[
i
],
BLAKE2S_OUTBYTES
) )
{
puts
(
"error"
);
return
-1
;
}
}
puts
(
"ok"
);
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL