aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_encode.3
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-04-26 22:36:47 +0200
committerMattias Andrée <m@maandree.se>2026-04-26 22:36:47 +0200
commitd77ab463184d113ca6119403887c9f4ed0dfdf0b (patch)
treeca8a1de443f90a4b7def56ea5b61c96aaa949f45 /librecrypt_encode.3
downloadlibrecrypt-d77ab463184d113ca6119403887c9f4ed0dfdf0b.tar.gz
librecrypt-d77ab463184d113ca6119403887c9f4ed0dfdf0b.tar.bz2
librecrypt-d77ab463184d113ca6119403887c9f4ed0dfdf0b.tar.xz
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'librecrypt_encode.3')
-rw-r--r--librecrypt_encode.393
1 files changed, 93 insertions, 0 deletions
diff --git a/librecrypt_encode.3 b/librecrypt_encode.3
new file mode 100644
index 0000000..95862f8
--- /dev/null
+++ b/librecrypt_encode.3
@@ -0,0 +1,93 @@
+.TH LIBRECRYPT_ENCODE 3 LIBRECRYPT
+.SH NAME
+librecrypt_encode - Encode binary salt or hash result into ASCII
+
+.SH SYNOPSIS
+.nf
+#include <librecrypt.h>
+
+size_t \fBlibrecrypt_encode\fP(char *\fIout_buffer\fP, size_t \fIsize\fP,
+ const void *\fIbinary\fP, size_t \fIlen\fP,
+ const char \fIlut\fP[restrict static 256], char \fIpad\fP);
+.fi
+.PP
+Link with
+.IR -lrecrypt .
+
+.SH DESCRIPTION
+The
+.BR librecrypt_encode ()
+function encodes
+.I len
+bytes of binary data from
+.IR binary
+into an ASCII representation written to
+.IR out_buffer .
+This is used for encoding hash results and salts.
+.PP
+The
+.I lut
+argument is an encoding alphabet, consisting
+of 64 characters, repeated 4 times.
+.PP
+The
+.I pad
+argument specifies the padding character to
+use at the end, or the null byte if none.
+.PP
+On successful completion, up to
+.I size
+bytes are written to
+.IR out_buffer ;
+if
+.I size
+is positive, the output is always
+null byte-terminated even if truncated.
+.PP
+The return value is the number of bytes
+that would have been written, excluding
+the terminating null byte, if
+.I size
+was sufficiently large.
+
+.SH RETURN VALUES
+The
+.BR librecrypt_encode ()
+function returns the number of bytes that
+would have been written to
+.IR out_buffer ,
+excluding the terminating null byte.
+
+.SH ERRORS
+The
+.BR librecrypt_encode ()
+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_encode ()
+T} Thread safety MT-Safe
+T{
+.BR librecrypt_encode ()
+T} Async-signal safety AS-Safe
+.TE
+.sp
+
+.SH HISTORY
+The
+.BR librecrypt_encode ()
+function was introduced in version 1.0 of
+.BR librecrypt .
+
+.SH SEE ALSO
+.BR librecrypt (7),
+.BR librecrypt_decode (3),
+.BR librecrypt_get_encoding (3)