]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/xcrypt.3
malloc.3: Since glibc 2.29, realloc() is exposed by defining _DEFAULT_SOURCE
[thirdparty/man-pages.git] / man3 / xcrypt.3
CommitLineData
fea681da 1.\" Copyright 2003 walter harms (walter.harms@informatik.uni-oldenburg.de)
2297bf0e 2.\"
38f20bb9 3.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
fea681da 4.\" Distributed under GPL
38f20bb9 5.\" %%%LICENSE_END
e787eaba 6.\"
fea681da 7.\" this is the 3rd type of interface for cryptographic routines
02e6bca3 8.\" 1. encrypt() expects a bit field
fea681da
MK
9.\" 2. cbc_crypt() byte values
10.\" 3. xencrypt() a hexstring
11.\" to bad to be true :(
12.\"
4b8c67d9 13.TH XCRYPT 3 2017-09-15 "" "Linux Programmer's Manual"
fea681da
MK
14.SH NAME
15xencrypt, xdecrypt, passwd2des \- RFS password encryption
16.SH SYNOPSIS
fea681da 17.B "#include <rpc/des_crypt.h>"
68e4db0a 18.PP
b9f02710 19.BI "void passwd2des(char " *passwd ", char *" key ");"
68e4db0a 20.PP
b9f02710 21.BI "int xencrypt(char *" secret ", char *" passwd ");"
68e4db0a 22.PP
b9f02710 23.BI "int xdecrypt(char *" secret ", char *" passwd ");"
fea681da
MK
24.SH DESCRIPTION
25The function
63aa9df0 26.BR passwd2des ()
fea681da
MK
27takes a character string
28.I passwd
29of arbitrary length and fills a character array
30.I key
c13182ef
MK
31of length 8.
32The array
fea681da 33.I key
c13182ef
MK
34is suitable for use as DES key.
35It has odd parity set in bit 0 of each byte.
fea681da
MK
36Both other functions described here use this function to turn their
37argument
38.I passwd
39into a DES key.
dd3568a1 40.PP
c13182ef 41The
63aa9df0 42.BR xencrypt ()
fea681da
MK
43function takes the ASCII character string
44.I secret
45given in hex,
46.\" (over the alphabet 0123456789abcdefABCDEF),
47which must have a length that is a multiple of 16,
48encrypts it using the DES key derived from
49.I passwd
50by
63aa9df0 51.BR passwd2des (),
fea681da
MK
52and outputs the result again in
53.I secret
54as a hex string
55.\" (over the alphabet 0123456789abcdef)
56of the same length.
dd3568a1 57.PP
fea681da 58The
63aa9df0 59.BR xdecrypt ()
fea681da 60function performs the converse operation.
47297adb 61.SH RETURN VALUE
fea681da 62The functions
63aa9df0 63.BR xencrypt ()
fea681da 64and
63aa9df0 65.BR xdecrypt ()
fea681da 66return 1 on success and 0 on error.
a759cc87 67.SH VERSIONS
42604799 68These functions are available in glibc since version 2.1.
8d2cf26d
ZL
69.SH ATTRIBUTES
70For an explanation of the terms used in this section, see
71.BR attributes (7).
72.TS
73allbox;
332d6855 74lbw37 lb lb
8d2cf26d
ZL
75l l l.
76Interface Attribute Value
77T{
78.BR passwd2des (),
79.BR xencrypt (),
80.BR xdecrypt ()
81T} Thread safety MT-Safe
82.TE
847e0d88 83.sp 1
fea681da
MK
84.SH BUGS
85The prototypes are missing from the abovementioned include file.
47297adb 86.SH SEE ALSO
fea681da 87.BR cbc_crypt (3)