.\" FreeSec: libcrypt for NetBSD .\" .\" Copyright (c) 1994 David Burren .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the author nor the names of other contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" %Id: crypt.3,v 1.6 1997/02/22 14:40:30 peter Exp % .\" .\" Manual page, using -mandoc macros .\" .\" $FreeBSD$ .Dd March 9, 1994 .Dt CRYPT 3 .Os .Sh ̾�� .Nm crypt , .Nm setkey , .Nm encrypt , .Nm des_setkey , .Nm des_cipher .Nd DES �Ź沽 .Sh �� .Fd #include <unistd.h> .Ft char * .Fn crypt "const char *key" "const char *setting" .Ft int .Fn setkey "const char *key" .Ft int .Fn encrypt "char *block" "int flag" .Ft int .Fn des_setkey "const char *key" .Ft int .Fn des_cipher "const char *in" "char *out" "long salt" "int count" .Sh ���� .Fn crypt �ؿ��ϡ��ѥ���ɤΰŹ沽��Ԥ��ޤ�������� .Tn NBS �ǡ����Ź沽���� (NBS Data Encryption Standard) ��ͳ�褹���ΤǤ������������λ�ߤ� �ɻߤ��뤿��ˡ�����¾�Υ����ɤ��ɲä���Ƥ��ޤ��� .Nm crypt �κǽ�ΰ����� .Dv NUL �ǽ�λ���륹�ȥ�Ǥ� ( �̾�ϡ��桼�������Ϥ����ѥ���� ) �� 2 �֤�� �����ϡ�Ĺ���� 9 �Х��ȤΥ���饯������Ǥ��ꡢ������������� (``_'') �ˡ� 4 �Х��Ȥ�ȿ��������Ȥ� 4 �Х��Ȥ� salt ��³������Τǹ�������ޤ���ȿ�� .Fa count �� .Fa salt ��ξ����������饯�������� 6 �ӥåȤǥ����ɤ���ޤ��� �Dz��̥ӥåȤ��ǽ�Ǥ������줾�� 0 ���� 63 ���ͤ��� ``./0-9A- Za-z'' ����饯���ˤ�äƥ����ɤ���ޤ��� .Pp .Fa salt ����Ѥ��ơ� 16777216 �Ĥβ�ǽ����ˡ�� 1 �Ĥǡ� .Tn DES ���르�ꥺ����� ̵���������������ޤ� ( �äˡ� .Ar salt �Υӥå� .Em i �����ꤵ��Ƥ��ꡢ .Em i �ӥåȤ� .Em i+24 �ӥåȤ� .Tn DES "E" �ܥå������Ϥǥ���åפ������Ǥ� ) �� .Ar key �� 8 ����饯���Υ��롼�פ�ʬ����� ( �Ǹ��û�����롼�פ� NULL �ǥѥåɤ���ޤ� ) ���ƥ���饯���β��̤� 7 �ӥå� ( ���롼�פ��Ȥ� 56 �� ) �����ʹߤΤ褦�� DES �������������Τ˻��Ѥ���ޤ��� 56 �ӥåȤκǽ�Υ��롼�פ������ DES �����ˤʤ�ޤ�������¾�γƥ��롼�פˤĤ��Ƥϡ����롼�ץӥåȤ���� DES �������ΤΰŹ沽����¾Ū������ (XOR) ������ DES �����ˤʤ�ޤ����Ǹ�ˡ� �ǽ�Ū�� DES ���������Ѥ���� 64 �ӥå������ .Ar count ���ѰŹ沽�� �¹Ԥ���ޤ����֤�����ͤϡ� .Dv NUL �ǽ�λ���륹�ȥ�ǡ�Ĺ���� 20 �Х��ȡ� .Ar setting �˥����ɤ��줿 64 �ӥåȤΰŹ沽��³������Τǹ�������ޤ��� .Pp .Xr crypt 3 �β��ΥС������Ȥθߴ����Τ���ˡ� .Ar setting �ϡ��嵭�Τ褦�� �����ɤ��줿 2 �Х��Ȥ� salt �ǹ����Ǥ��ޤ������ξ�硢ȿ�� .Ar count 25 �� ���Ѥ��졢��ư�ξ��ʤ� .Tn DES �����ѤǤ�����Ĺ 8 ����饯���� .Ar key �� ���Ѥ���ޤ����֤�����ͤ� .Dv NUL �ǽ�λ����Ĺ���� 13 �Х��ȤΥ��ȥ�� �Ǥ��� .Pp �ؿ� .Fn encrypt �� .Fn setkey �� .Fn des_setkey ������� .Fn des_cipher �Ǥϡ� .Tn DES ���르�ꥺ��ˡ����¤��줿�����������Ǥ��ޤ��� .Fn setkey �ؤΥ��� .Ar key �����ϡ� 64 ����饯���ΥХ��ʥ��� ( ������ 0 �ޤ��� 1) ������Ǥ��� 56 �ӥåȤ� �����Ϥ�������Ƴ�Ф���ޤ������Τ���ˤϡ������ 8 �ĤΥ��롼�פ� ʬ�䤷���ƥ��롼����κǸ�ΥӥåȤ�̵�뤷�ޤ��� .Pp .Fn encrypt �ΰ��� .Fa block �⡢�Х��ʥ��ͤ� 64 ����饯������Ǥ��� .Fa flag ���ͤ� 0 �ξ�硢���� .Fa block �ϰŹ沽����ޤ��������Ǥʤ����ϡ� �Ź�������ޤ����Ź沽�ޤ��ϰŹ����ϡ������������뤿��� .Fn setkey �� ���ꤷ����������Ѥ����塢���ꥸ�ʥ������ .Fa block ����֤���ޤ��� .Pp .Fn des_setkey �ؿ��� .Fn des_cipher �ؿ��Ϲ�®�Ǥ����� .Fn setkey ����� .Fn encrypt ���ܿ���������ޤ��� .Fn des_setkey �ؤΰ����ϡ�Ĺ���� 8 �� ����饯������Ǥ����ƥ���饯���� .Em �Dz��� �ӥåȤ�̵�뤵�졢�ƥ���饯���� ���� 7 �ӥåȤ�Ϣ�뤵��� 56 �ӥåȤΥ������������ޤ����ؿ� .Fn des_cipher �ϡ� .Tn DES �� .Fa count ȿ���� .Xr abs 3 ����Ѥ��� .Fa in �� 8 ����饯�������¸���줿 64 �ӥåȤ�Ź沽 ( �ޤ��� .Fa count ����ξ��ϰŹ��� ) ���� 64 �ӥåȤη�̤� 8 ����饯���� .Fa out ����¸���ޤ��� .Fa salt �ϡ������Τ褦�� .Tn DES ����ư�� ���ꤷ�ޤ��� .Pp �ؿ� .Fn crypt �ϡ������������������ϰŹ沽���줿�ͤ�ؤ��ݥ����֤��� ���������Ԥ������� NULL ���֤��ޤ����ؿ� .Fn setkey �� .Fn encrypt �� .Fn des_setkey ������� .Fn des_cipher �ϡ������������������� 0 ���֤��������� ���Ԥ������� 1 ���֤��ޤ������Ū�ˤϡ��ؿ� .Fn setkey �� .Fn encrypt �ϤɤΤ褦���ͤ��֤��ޤ���Ǥ����������δؿ�������ͤ���ꤵ�줿�Τϡ� ��˥ϡ��ɥ��������ݡ��Ȥ�����äƤ����Τλ��ѤϤǤ��ʤ���硢�ޤ��� �̾�����ˤζ��Τ���� DES �����ѤǤ��ʤ����ˡ������ƥ�� ���̤��뤿��Ǥ��� .Pp .Fn crypt ����Ѥ���ˤϡ� .Nm libcrypt �饤�֥��ȤΥ��ɬ�פǤ��� .Fn setkey �� .Fn encrypt �� .Fn des_setkey ������� .Fn des_cipher �ϡ� .Nm libcipher �饤�֥����� ���Ĥ���ޤ��� ( ɸ��� C �饤�֥�ꡢ .Nm libc �ˤϤ����Υ롼����ؤΤ����餷�� ���äƤ��ޤ��� ) �� .Sh ��Ϣ���� .Xr login 1 , .Xr passwd 1 , .Xr getpass 3 , .Xr passwd 5 .Rs .%T "Mathematical Cryptology for Computer Scientists and Mathematicians" .%A Wayne Patterson .%D 1987 .%N ISBN 0-8476-7438-X .Re .Rs .%T "Password Security: A Case History" .%A R. Morris .%A Ken Thompson .%J "Communications of the ACM" .%V vol. 22 .%P pp. 594-597 .%D Nov. 1979 .Re .Rs .%T "DES will be Totally Insecure within Ten Years" .%A M.E. Hellman .%J "IEEE Spectrum" .%V vol. 16 .%P pp. 32-39 .%D July 1979 .Re .Sh ��� ������������Ѥ��� .Fn crypt �ؿ��ϡ� .At v6 �Ǹ���ޤ��������ߤ� ��������� .Fn crypt �ϡ��ǽ�� .At v7 �˸���ޤ����� .Sh �Х� .Fn des_setkey �ؤΰ����γƥ���饯���� .Em �Dz��� �ӥåȤ� ��Ȥ��ΤϤȤ�Ǥ�ʤ����ȤǤ��� .Pp .Fn crypt �ؿ��ϡ���̤���������Ū���֥������Ȥ˻Ĥ������Υ��֥������Ȥ�ؤ� �ݥ����֤��ޤ������ .Fn crypt ��ƤӽФ��ȡ�Ʊ�����֥������Ȥ� ��������ޤ���