.\" -*- coding: UTF-8 -*- .\" Copyright 2000 Nicolás Lichtmaier .\" Created 2000-07-22 00:52-0300 .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" 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. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\" Modified 2002-07-23 19:21:35 CEST 2002 Walter Harms .\" .\" .\" Modified 2003-04-04, aeb .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH ENCRYPT 3 "1 Noviembre 2020" "" "Manual del Programador de Linux" .SH NOMBRE encrypt, setkey, encrypt_r, setkey_r \- cifra mensajes de 64 bit .SH SINOPSIS .nf \fB#define _XOPEN_SOURCE\fP /* Vea feature_test_macros(7) */ \fB#include \fP .PP \fBvoid encrypt(char \fP\fIblock\fP\fB[64], int \fP\fIedflag\fP\fB);\fP \fB#define _XOPEN_SOURCE\fP /* Véase feature_test_macros(7) */ \fB#include \fP .PP \fBvoid setkey(const char *\fP\fIkey\fP\fB);\fP \fB#define _GNU_SOURCE\fP /* Vea feature_test_macros(7) */ \fB#include \fP .PP \fBvoid setkey_r(const char *\fP\fIkey\fP\fB, struct crypt_data *\fP\fIdata\fP\fB);\fP \fBvoid encrypt_r(char *\fP\fIblock\fP\fB, int \fP\fIedflag\fP\fB, struct crypt_data *\fP\fIdata\fP\fB);\fP .fi .PP Each of these requires linking with \fI\-lcrypt\fP. .SH DESCRIPCIÓN These functions encrypt and decrypt 64\-bit messages. The \fBsetkey\fP() function sets the key used by \fBencrypt\fP(). The \fIkey\fP argument 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. .PP The \fBencrypt\fP() function modifies the passed buffer, encoding if \fIedflag\fP is 0, and decoding if 1 is being passed. Like the \fIkey\fP argument, also \fIblock\fP is a bit vector representation of the actual value that is encoded. The result is returned in that same vector. .PP These two functions are not reentrant, that is, the key data is kept in static storage. The functions \fBsetkey_r\fP() and \fBencrypt_r\fP() are the reentrant versions. They use the following structure to hold the key data: .PP .in +4n .EX struct crypt_data { char keysched[16 * 8]; char sb0[32768]; char sb1[32768]; char sb2[32768]; char sb3[32768]; char crypt_3_buf[14]; char current_salt[2]; long current_saltbits; int direction; int initialized; }; .EE .in .PP Before calling \fBsetkey_r\fP() set \fIdata\->initialized\fP to zero. .SH "VALOR DEVUELTO" Estas funciones no devuelven ningún valor. .SH ERRORES Set \fIerrno\fP to zero before calling the above functions. On success, it is unchanged. .TP \fBENOSYS\fP Esta función no está implementado. Por ejemplo, debido a antiguas restricciones de importaciones en Estados Unidos. .SH VERSIONES Because they employ the DES block cipher, which is no longer considered secure, \fBcrypt\fP(), \fBcrypt_r\fP(), \fBsetkey\fP(), and \fBsetkey_r\fP() were removed in glibc 2.28. Applications should switch to a modern cryptography library, such as \fBlibgcrypt\fP. .SH ATRIBUTOS Para obtener una explicación de los términos usados en esta sección, véase \fBattributes\fP(7). .TS allbox; lbw23 lb lb l l l. Interfaz Atributo Valor T{ \fBencrypt\fP(), \fBsetkey\fP() T} Seguridad del hilo MT\-Unsafe race:crypt T{ \fBencrypt_r\fP(), \fBsetkey_r\fP() T} Seguridad del hilo Multi\-hilo seguro .TE .SH "CONFORME A" \fBencrypt\fP(), \fBsetkey\fP(): POSIX.1\-2001, POSIX.1\-2008, SUS, SVr4. .PP Las funciones \fBencrypt_r\fP() y \fBsetkey_r\fP() son extensiones de GNU. .SH NOTAS .SS "Disponibilidad en glibc" Vea \fBcrypt\fP(3). .SS "Características en glibc" In glibc 2.2, these functions use the DES algorithm. .SH EJEMPLOS .EX #define _XOPEN_SOURCE #include #include #include #include int main(void) { char key[64]; char orig[9] = "eggplant"; char buf[64]; char txt[9]; for (int i = 0; i < 64; i++) { key[i] = rand() & 1; } for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { buf[i * 8 + j] = orig[i] >> j & 1; } setkey(key); } printf("Before encrypting: %s\en", orig); encrypt(buf, 0); for (int i = 0; i < 8; i++) { for (int j = 0, txt[i] = \(aq\e0\(aq; j < 8; j++) { txt[i] |= buf[i * 8 + j] << j; } txt[8] = \(aq\e0\(aq; } printf("After encrypting: %s\en", txt); encrypt(buf, 1); for (int i = 0; i < 8; i++) { for (int j = 0, txt[i] = \(aq\e0\(aq; j < 8; j++) { txt[i] |= buf[i * 8 + j] << j; } txt[8] = \(aq\e0\(aq; } printf("After decrypting: %s\en", txt); exit(EXIT_SUCCESS); } .EE .SH "VÉASE TAMBIÉN" .\" .BR fcrypt (3) \fBcbc_crypt\fP(3), \fBcrypt\fP(3), \fBecb_crypt\fP(3), .SH COLOFÓN Esta página es parte de la versión 5.10 del proyecto Linux \fIman\-pages\fP. Puede encontrar una descripción del proyecto, información sobre cómo informar errores y la última versión de esta página en \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Miguel Pérez Ibars y Marcos Fouces . .PP Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. .PP Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org .ME .