1502 Remove conversion cruft from manpages
[unleashed.git] / usr / src / man / man3c / encrypt.3c
blob222d1b52563de5e5ec8dc2889748a11e4643f862
1 '\" te
2 .\"  Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved  Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\"  This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH ENCRYPT 3C "May 2, 2001"
11 .SH NAME
12 encrypt \- encoding function
13 .SH SYNOPSIS
14 .LP
15 .nf
16 #include <crypt.h>
18 \fBvoid\fR \fBencrypt\fR(\fBchar\fR \fIblock[64]\fR, \fBint\fR \fIedflag\fR);
19 .fi
21 .SS "Standard conforming"
22 .LP
23 .nf
24 #include <unistd.h>
26 \fBvoid\fR \fBencrypt\fR(\fBchar\fR \fIblock[64]\fR, \fBint\fR \fIedflag\fR);
27 .fi
29 .SH DESCRIPTION
30 .sp
31 .LP
32 The \fBencrypt()\fR function provides (rather primitive) access to the hashing
33 algorithm employed by the \fBcrypt\fR(3C) function. The key generated by
34 \fBsetkey\fR(3C) is used to encrypt the string \fIblock\fR with
35 \fBencrypt()\fR.
36 .sp
37 .LP
38 The \fIblock\fR argument to \fBencrypt()\fR is an array of length 64 bytes
39 containing only the bytes with numerical value of 0 and 1. The array is
40 modified in place to a similar array using the key set by \fBsetkey\fR(3C). If
41 \fIedflag\fR is 0, the argument is encoded.  If \fIedflag\fR is 1, the argument
42 may be decoded (see the \fBUSAGE\fR section below); if the argument is not
43 decoded, \fBerrno\fR will be set to \fBENOSYS\fR.
44 .SH RETURN VALUES
45 .sp
46 .LP
47 The \fBencrypt()\fR function returns no value.
48 .SH ERRORS
49 .sp
50 .LP
51 The \fBencrypt()\fR function will fail if:
52 .sp
53 .ne 2
54 .na
55 \fB\fBENOSYS\fR\fR
56 .ad
57 .RS 10n
58 The functionality is not supported on this implementation.
59 .RE
61 .SH USAGE
62 .sp
63 .LP
64 In some environments, decoding may not be implemented.  This is related to U.S.
65 Government restrictions on encryption and decryption routines: the \fBDES\fR
66 decryption algorithm cannot be exported outside the U.S.A. Historical practice
67 has been to ship a different version of the encryption library without the
68 decryption feature in the routines supplied. Thus the exported version of
69 \fBencrypt()\fR does encoding but not decoding.
70 .sp
71 .LP
72 Because \fBencrypt()\fR does not return a value, applications wishing to check
73 for errors should set \fBerrno\fR to 0, call \fBencrypt()\fR, then test
74 \fBerrno\fR and, if it is non-zero, assume an error has occurred.
75 .SH ATTRIBUTES
76 .sp
77 .LP
78 See \fBattributes\fR(5) for descriptions of the following attributes:
79 .sp
81 .sp
82 .TS
83 box;
84 c | c
85 l | l .
86 ATTRIBUTE TYPE  ATTRIBUTE VALUE
88 Interface Stability     Standard
90 MT-Level        Safe
91 .TE
93 .SH SEE ALSO
94 .sp
95 .LP
96 \fBcrypt\fR(3C), \fBsetkey\fR(3C), \fBattributes\fR(5)