Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/encrypt.html
2024-02-19 00:21:47 -05:00

147 lines
5.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>encrypt</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="encrypt"></a> <a name="tag_03_116"></a><!-- encrypt -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_116_01"></a>NAME</h4>
<blockquote>encrypt - encoding function (<b>CRYPT</b>)</blockquote>
<h4><a name="tag_03_116_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
"[Option Start]" border="0"> #include &lt;<a href="../basedefs/unistd.h.html">unistd.h</a>&gt;<br>
<br>
void encrypt(char</tt> <i>block</i><tt>[64], int</tt> <i>edflag</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]"
border="0"></tt></code></div>
<tt><br>
</tt></blockquote>
<h4><a name="tag_03_116_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>encrypt</i>() function shall provide access to an implementation-defined encoding algorithm. The key generated by <a
href="../functions/setkey.html"><i>setkey</i>()</a> is used to encrypt the string <i>block</i> with <i>encrypt</i>().</p>
<p>The <i>block</i> argument to <i>encrypt</i>() shall be an array of length 64 bytes containing only the bytes with values of 0
and 1. The array is modified in place to a similar array using the key set by <a href=
"../functions/setkey.html"><i>setkey</i>()</a>. If <i>edflag</i> is 0, the argument is encoded. If <i>edflag</i> is 1, the argument
may be decoded (see the APPLICATION USAGE section); if the argument is not decoded, <i>errno</i> shall be set to [ENOSYS].</p>
<p>The <i>encrypt</i>() function shall not change the setting of <i>errno</i> if successful. An application wishing to check for
error situations should set <i>errno</i> to 0 before calling <i>encrypt</i>(). If <i>errno</i> is non-zero on return, an error has
occurred.</p>
<p>The <i>encrypt</i>() function need not be reentrant. A function that is not required to be reentrant is not required to be
thread-safe.</p>
</blockquote>
<h4><a name="tag_03_116_04"></a>RETURN VALUE</h4>
<blockquote>
<p>The <i>encrypt</i>() function shall not return a value.</p>
</blockquote>
<h4><a name="tag_03_116_05"></a>ERRORS</h4>
<blockquote>
<p>The <i>encrypt</i>() function shall fail if:</p>
<dl compact>
<dt>[ENOSYS]</dt>
<dd>The functionality is not supported on this implementation.</dd>
</dl>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_116_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_116_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>Historical implementations of the <i>encrypt</i>() function used a rather primitive encoding algorithm.</p>
<p>In some environments, decoding might not be implemented. This is related to some Government restrictions on encryption and
decryption routines. Historical practice has been to ship a different version of the encryption library without the decryption
feature in the routines supplied. Thus the exported version of <i>encrypt</i>() does encoding but not decoding.</p>
</blockquote>
<h4><a name="tag_03_116_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_116_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_116_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="crypt.html"><i>crypt</i>()</a> , <a href="setkey.html"><i>setkey</i>()</a> , the Base Definitions volume of
IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/unistd.h.html"><i>&lt;unistd.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_116_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 1. Derived from Issue 1 of the SVID.</p>
</blockquote>
<h4><a name="tag_03_116_12"></a>Issue 5</h4>
<blockquote>
<p>A note indicating that this function need not be reentrant is added to the DESCRIPTION.</p>
</blockquote>
<h4><a name="tag_03_116_13"></a>Issue 6</h4>
<blockquote>
<p>In the DESCRIPTION, the note about reentrancy is expanded to cover thread-safety.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>