aboutsummaryrefslogtreecommitdiffstats
path: root/libar2simplified_hash.3
blob: 71f0bd0bde84ab581625f4b6b5c03479b7b5da96 (plain) (blame)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
.TH LIBAR2SIMPLIFIED_HASH 3 LIBAR2SIMPLIFIED
.SH NAME
libar2simplified_hash - Hash a password with Argon2

.SH SYNOPSIS
.nf
#include <libar2simplified.h>

int libar2simplified_hash(void *\fIhash\fP, void *\fImsg\fP, size_t \fImsglen\fP, struct libar2_argon2_parameters *\fIparams\fP);
.fi
.PP
Link with
.IR "-lar2simplified -lar2 -lblake -lrt -pthread" .

.SH DESCRIPTION
The
.BR libar2simplified_hash ()
function calculates an Argon2 if the message
provided in the
.I msg
parameter, whose length (in bytes) is provided in the
.I msglen
parameter, according to the hashing parameters
specified in the
.I params
parameter. See
.BR libar2_hash (3)
for more information about
.IR params .
The hash (tag) is stored, in raw binary format
(does not include the hashing parameters) in
the buffer provided via the
.I hash
parameter. This buffer must be at least
.I libar2_hash_buf_size(params)
bytes large.
.PP
The
.BR libar2simplified_hash ()
function will erase (not deallocate) the contents of
.I msg
before returning.
.PP
Only
.I msg
may be
.IR NULL ,
but only if
.I msglen
is 0.

.SH RETURN VALUES
The
.BR libar2simplified_hash ()
function returns 0 upon successful completion.
On error, -1 is returned and
.I errno
is set to describe the error.

.SH ERRORS
The
.BR libar2simplified_hash ()
function will fail if:
.TP
.B EINVAL
The contents of
.I str
is invalid or unsupported.
.TP
.B ENOMEM
Insufficient storage space is available.
.TP
.BR ENOSPC " or " EAGAIN
A resource required to initialise some item
needed for threading-support has been exhausted
or the number of instances of such items have
been reached.
.TP
.B EOWNERDEAD
A thread terminated unexpectedly.

.SH SEE ALSO
.BR libar2simplified (7),
.BR libar2simplified_decode (3),
.BR libar2simplified_encode (3),
.BR libar2simplified_encode_hash (3),
.BR libar2simplified_crypt (3),
.BR libar2_hash (3),
.BR libar2_hash_buf_size (3)