blob: ca8bdf362c491641aa6bff0e759e8e01a05426bf (
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
90
91
92
93
94
95
96
|
.TH LIBRECRYPT_NEXT_ALGORITHM 3 LIBRECRYPT
.SH NAME
librecrypt_next_algorithm - Iterate over algorithms in a chained password hash string
.SH SYNOPSIS
.nf
#include <librecrypt.h>
.PP
char *\fBlibrecrypt_next_algorithm\fP(char **\fIhash\fP);
.fi
.PP
Link with
.IR -lrecrypt .
.SH DESCRIPTION
The
.BR librecrypt_next_algorithm ()
function is called repeatedly to extract each hash
algorithm (including its parameters) that shall be
chained together according to a provided hash string.
.PP
On the initial call,
.I *hash
shall point to the password hash string.
On each call the function updates
.I *hash
to its current parsing state. On each call except
the final one, the string is modified by replacing
the next instance of
.I LIBRECRYPT_ALGORITHM_LINK_DELIMITER
(which is
.BR \(aq>\(aq )
with a null byte.
.PP
Each call returns the next algorithm substring.
Once all algorithms have been extracted and returned,
.IR NULL
is returned.
.PP
Except once the function has returned
.IR NULL ,
overwriting the terminating null byte in the previously
returned substring
with
.I LIBRECRYPT_ALGORITHM_LINK_DELIMITER
restores the original hash string.
.PP
Unless already stripped out before input, the last
returned substring ends with the resulting hash.
.PP
.I hash
must not be
.IR NULL .
.SH RETURN VALUES
The
.BR librecrypt_next_algorithm ()
function returns a pointer to the next algorithm
substring, or
.IR NULL
when no more algorithms remain.
.SH ERRORS
The
.BR librecrypt_next_algorithm ()
function cannot fail.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.PP
.TS
allbox;
lb lb lb
l l l.
Interface Attribute Value
T{
.BR librecrypt_next_algorithm ()
T} Thread safety MT-Safe
T{
.BR librecrypt_next_algorithm ()
T} Async-signal safety AS-Safe
.TE
.sp
.SH HISTORY
The
.BR librecrypt_next_algorithm ()
function was introduced in version 1.0 of
.BR librecrypt .
.SH SEE ALSO
.BR librecrypt (7),
.BR librecrypt_chain_length (3),
.BR librecrypt_decompose_chain (3),
.BR librecrypt_decompose_chain1 (3)
|