.\" -*- coding: UTF-8 -*- '\" t .\" Copyright 2000 Nicolás Lichtmaier .\" Created 2000-07-22 00:52-0300 .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" .\" 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 "5 Febrero 2023" "Páginas de manual de Linux 6.03" .SH NOMBRE encrypt, setkey, encrypt_r, setkey_r \- cifra mensajes de 64 bit .SH BIBLIOTECA Biblioteca para cifrado y descifrado (\fIlibcrypto\fP, \fI\-lcrypto\fP) .SH SINOPSIS .nf \fB#define _XOPEN_SOURCE\fP /* Vea feature_test_macros(7) */ \fB#include \fP .PP \fB[[a extinguir]] void encrypt(char \fP\fIblock\fP\fB[64], int \fP\fIedflag\fP\fB);\fP .PP \fB#define _XOPEN_SOURCE\fP /* Véase feature_test_macros(7) */ \fB#include \fP .PP \fB[[a extinguir]] void setkey(const char *\fP\fIkey\fP\fB);\fP .PP \fB#define _GNU_SOURCE\fP /* Vea feature_test_macros(7) */ \fB#include \fP .PP \fB[[a extinguir]] void setkey_r(const char *\fP\fIkey\fP\fB, struct crypt_data *\fP\fIdata\fP\fB);\fP \fB[[a extinguir]] void encrypt_r(char *\fP\fIblock\fP\fB, int \fP\fIedflag\fP\fB,\fP \fB struct crypt_data *\fP\fIdata\fP\fB);\fP .fi .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 Define \fIerrno\fP a cero antes de invocar la función anterior. Si no ocurre ningún error, \fIerrno\fP no sufrirá ninguna variación. .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, \fBencrypt\fP(), \fBencrypt_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). .ad l .nh .TS allbox; lbx 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 .hy .ad .sp 1 .SH ESTÁNDARES \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 .\" [[deprecated]] SRC BEGIN (encrypt.c) .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 (size_t i = 0; i < 64; i++) { key[i] = rand() & 1; } for (size_t i = 0; i < 8; i++) { for (size_t 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 (size_t i = 0; i < 8; i++) { for (size_t 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 (size_t i = 0; i < 8; i++) { for (size_t 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 .\" SRC END .SH "VÉASE TAMBIÉN" \fBcbc_crypt\fP(3), \fBcrypt\fP(3), \fBecb_crypt\fP(3) .\" .BR fcrypt (3) .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 .