Name
encrypt, setkey, encrypt_r, setkey_r — encrypt
64-bit messages
Synopsis
void
encrypt( |
char |
block, |
| |
int |
edflag); |
void
setkey( |
const char * |
key); |
void
setkey_r( |
const char * |
key, |
| |
struct crypt_data
* |
data); |
void
encrypt_r( |
char * |
block, |
| |
int |
edflag, |
| |
struct crypt_data
* |
data); |
DESCRIPTION
These functions encrypt and decrypt 64-bit messages. The
setkey() function sets the key
used by encrypt(). The
key parameter used
here is an array of 64 bytes, each of which has numerical
value 1 or 0. The bytes key[n] where n=8*i-1 are ignored, so
that the effective key length is 56 bits.
The encrypt() function
modifies the passed buffer, encoding if edflag is 0, and decoding if 1
is being passed. Like the key parameter also block is a bit vector
representation of the actual value that is encoded. The
result is returned in that same vector.
These two functions are not reentrant, that is, the key
data is kept in static storage. The functions setkey_r() and encrypt_r() are the reentrant versions.
They use the following structure to hold the key data:
Before calling setkey_r()
set data->initialized to
zero.
RETURN VALUE
These functions do not return any value.
ERRORS
Set errno to zero before
calling the above functions. On success, it is unchanged.
- ENOSYS
-
The function is not provided. (For example because
of former USA export restrictions.)
CONFORMING TO
The functions encrypt() and
setkey() conform to SVr4,
SUSv2, and POSIX.1-2001. The functions encrypt_r() and setkey_r() are GNU extensions.
NOTES
In glibc 2.2 these functions use the DES algorithm.
EXAMPLE
You need to link with libcrypt to compile this example
with glibc 2.2. To do useful work the key[] and txt[] arrays
must be filled with a useful bit pattern.
SEE ALSO
cbc_crypt(3), crypt(3), ecb_crypt(3), feature_test_macros(7)
Copyright 2000 Nicolás Lichtmaier <nick@debian.org>
Created 2000-07-22 00:52-0300
This is free documentation; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
The GNU General Public License's references to "object code"
and "executables" are to be interpreted as the output of any
document formatting or typesetting system, including
intermediate and printed output.
This manual is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Modified 2002-07-23 19:21:35 CEST 2002 Walter Harms
<walter.harms@informatik.uni-oldenburg.de>
Modified 2003-04-04, aeb
|