Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-doc
Path: blob/main/documentation/manual-pages/ja/man3/crypt.3
18093 views
.\" 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.
.\"
.\"     %FreeBSD: src/lib/libcrypt/crypt.3,v 1.6.2.12 2001/12/17 10:08:29 ru Exp %
.\" $FreeBSD$
.\"
.\" Manual page, using -mandoc macros
.\"
.Dd January 19, 1997
.Dt CRYPT 3
.Os
.Sh ̾��
.Nm crypt
.Nd �ȥ�åץɥ��Ź沽
.Sh �饤�֥��
.Lb libcrypt
.Sh ��
.In unistd.h
.Ft char *
.Fn crypt "const char *key" "const char *salt"
.Ft const char *
.Fn crypt_get_format "void"
.Ft int
.Fn crypt_set_format "const char *string"
.Sh ����
.Fn crypt
�ؿ��ϡ��ѥ���ɤΥϥå��岽��Ԥʤ������������λ�ߤ�
�פ��Ȥɤޤ餻�뤿��Υ����ɤ��ղä��ޤ���
�ϥå��岽�ˤϰۤʤ륢�르�ꥺ�����Ѥ��뤳�Ȥ��Ǥ��ޤ���
.\"
.\" NOTICE:
.\" If you add more algorithms, make sure to update this list
.\" and the default used for the Traditional format, below.
.\"
���ߴޤޤ�륢�르�ꥺ��ϡ�
.Tn NBS
.Tn Data Encryption Standard (DES) ,
.Tn MD5 ,
.Tn Blowfish
�Ǥ���
.Tn DES
��
.Tn Blowfish
�����󥹥ȡ��뤵��Ƥ��뤫�ɤ������ޤ���
�ǥե���Ȥ��ѹ����뤿���
.Fn crypt_set_format
�����Ǥ˸ƤӽФ���Ƥ��뤫�ɤ����ˤ�ꡢ
���Ѥ���륢�르�ꥺ��� salt
(�⥸�塼�벽�Ź�ե����ޥå� (Modular Crypt Format (MCF)) �˽����ޤ�)
�Υե����ޥåȤ˰�¸���ޤ���
.Pp
.Nm
�κǽ�ΰ����ϥϥå��岽�Τ���Υǡ��� (�̾�ϥѥ���ɤǤ�) �ǡ�
�̥�ʸ���ǽ�λ����ʸ����Ǥ���
2 �֤�ΰ����� salt �ǡ����� 3 �ĤΤ����Τ����줫�η����Ǥ���
.Pp
.Bl -tag -width Traditional -compact -offset indent
.It Extended
�����������
.Pq Dq _
�ǻϤޤ��硢���β��� salt �β���Ȥ�ˡ����˳��פ���������
.Tn DES
��ĥ��������Ѥ��ޤ���
.It Modular
ʸ����
.Dq $digit$
�ǻϤޤ��硢���˳��פ���������
�⥸�塼�벽�Ź�ե����ޥå� (MCF) ����Ѥ��ޤ���
.It Traditional
��Τ�����ˤ⳺�����ʤ���硢����Ū�ʥե����ޥå� (Traditional Format)
�����ꤷ��ʸ�������� (�ޤ��Ϻǽ����ʬ) �� salt �Ȥ��ƻ��Ѥ��ޤ���
.El
.Pp
�ɤΥ롼�����׻��˻��֤��ݤ����߷פˤʤäƤ��ޤ���
.Tn Pentium
166/MMX �Ǵ�ñ�ʥƥ��Ȥ򤹤�ȡ�
.Tn DES
�Ź沽�Ǥϡ�1 CPU ��������Ź沽���� 2640 ��Ԥʤ���
MD5 �Ź沽�Ǥϡ�1 CPU ��������Ź沽���� 62 ��Ԥʤ��ޤ�����
.Ss DES ��ĥ����:
.Pp
��
.Ar key
�� 8 ʸ������ʤ륰�롼�פ�ʬ�䤵��ޤ� (�Ǹ�Υ��롼�פˤϥʥ�Х��Ȥ�
�ͤ���ޤ�)��
�ƥ���饯���β��� 7 �ӥå� (���롼�פ��Ȥ� 56 �ӥå�) ����
������������褦�ˤ��ơ�
.Tn DES
�������뤿����Ѥ����ޤ���
�ǽ�Υ��롼�פ� 56 �ӥåȤϡ�
.Tn DES
���ν���ͤǤ���
���θ�Υ��롼�פ��Ȥˡ����ߤ�
.Tn DES
�����켫�ȤȤ��Υ��롼�פΥӥåȤ� XOR ���뤳�ȤǰŹ沽��������
.Tn DES
���Ȥ��ޤ���
.Pp
salt �� 9 ����饯��������Ǥ��ꡢ������������θ���� 4 �Х��Ȥ�
ȿ������� 4 �Х��Ȥ� salt ����ʤ�ޤ���
�����ϰ�����ǽʸ���ǥ��󥳡��ɤ���ޤ���
6 �ӥåȤ��Ȥ� 1 ʸ�����б��������Dz��̥���饯����ǽ�ˤ��ơ�
���󥳡��ɤ���ޤ���
0 ���� 63 �ޤǤ��ͤ� ``./0-9A-Za-z'' �Ȥ��ƥ��󥳡��ɤ���ޤ���
����ˤ��
.Fa count
��
.Fa salt
�Τ��줾��� 24 �ӥåȤ�Ȥ����Ȥ��Ǥ��ޤ���
.Pp
.Fa salt
��
.Tn DES
���르�ꥺ����Ф���16777216 �̤�ޤ��� 4096 �̤�
(�Ĥޤꡢ24 �ӥåȤޤ��� 12 �ӥå�)
��� 1 �̤�Ȥ����Ե�§����Ƴ�����ޤ� (
.Ar salt
�Υӥå�
.Em i
�����ꤵ��Ƥ����硢
.Tn DES
E-Box �������
�ӥå�
.Em i
�ȥӥå�
.Em i+24
�Ȥ��򴹤���ޤ�) ��
.Pp
.Tn DES
����Ȥ���64�ӥåȤ������
.Ar count
�� DES �򷫤��֤�Ŭ�Ѥ��Ź沽���ޤ���
�֤�����ͤϡ�
.Dv �̥�ʸ���ǽ�λ����
ʸ����ǡ�Ĺ����
20 �Х��Ȥޤ��� 13 �Х��� (�˥̥�ʸ�����ä��ޤ�) �ǡ�
.Ar salt
�θ�ˡ����󥳡��ɤ��줿 64 �ӥåȤΰŹ沽��³������Τ�
��������ޤ���
.Ss �⥸�塼�벽�Ź�:
.Pp
salt ��ʸ����
.Fa $digit$
����Ϥޤ���ϡ��⥸�塼�벽�Ź�ե����ޥå� (MCF) �����Ѥ���ޤ���
.Fa digit
�ϰŹ沽�κݤˤɤΥ��르�ꥺ�ब���Ѥ���뤫��ɽ���ޤ���
���θ���Υȡ����󤬼ºݤ� salt �Ȥ��ưŹ沽���Ѥ����ޤ���
salt ��Ĺ���� 16 ����饯�������¤���Ƥ��ޤ���
����ϡ��֤����Ϥ�Ĺ���� _PASSWORD_LEN �����¤���Ƥ��뤫��Ǥ���
salt �ϥ̥�ʸ�����ɥ뵭����������֤�ɬ�פ�����ޤ���
�ɥ뵭��θ����ʸ���Ϥʤ�Ǥ���̵�뤵��ޤ���
.Pp
���ߥ��ݡ��Ȥ��륢�르�ꥺ��ϡ�
.Pp
.Bl -enum -compact -offset indent
.It
MD5
.It
Blowfish
.El
.Pp
����ʳ��ΰŹ沽�ե����ޥåȤ��ưפ��ɲäǤ��ޤ���
salt ����Ȥ��Ƽ��Τ�Τ�����ޤ���
.Bl -tag -offset indent
.It Cm "$3$thesalt$rest"
.El
.Pp
.Ss "Traditional" �Ź沽:
.Pp
.\"X The algorithm used will depend upon whether
���Ѥ���륢�르�ꥺ��ϡ�
.Fn crypt_set_format
.\"X has been called and whether a global default format has been specified.
�����Ǥ˸ƤӽФ���Ƥ��뤫�ݤ����������Х�ǥե���ȥե����ޥåȤ�
���Ǥ˻��ꤵ��Ƥ��뤫�ݤ��˰�¸���ޤ���
.\"X Unless a global default has been specified or
�������Х�ǥե���Ȥ����餫������ꤵ��Ƥ��뤫��
.Fn crypt_set_format
.\"X has set the format to something else, the built-in default format is
.\"X used.
�Dz���¾�Υե����ޥåȤ����ꤵ��Ƥ��뤫�����Τɤ���Ǥ�ʤ���硢
�Ȥ߹��ߤΥǥե���ȥե����ޥåȤ����Ѥ���ޤ���
.\"X This is currently
���ߤΤȤ���������ϡ�
.\"X .\"
.\"X .\" NOTICE: Also make sure to update this
.\"X .\"
.\"X DES
.\"X if it is available, or MD5 if not.
DES ���Ȥ���ʤ� DES �ˡ������Ǥʤ��ʤ� MD5 �ˤʤ�ޤ���
.Pp
.\"X How the salt is used will depend upon the algorithm for the hash.  For
.\"X best results, specify at least two characters of salt.
salt ��ɤΤ褦���Ѥ��뤫�ϥϥå��岽�Υ��르�ꥺ��˰�¸���ޤ���
�ǹ�η�̤����뤿��ˡ����ʤ��Ȥ� 2 ʸ���� salt ����ꤷ�Ƥ���������
.Pp
.Fn crypt_get_format
.\"X function returns a constant string that represents the name of the
.\"X algorithm currently used.
�ؿ��ϸ��߻��Ѥ��Ƥ��륢�르�ꥺ���ɽ�����ʸ������֤��ޤ���
ͭ�����ͤϡ�
.\"X Valid values are
.\"X .\"
.\"X .\" NOTICE: Also make sure to update this, too, as well
.\"X .\"
.Ql des ,
.Ql blf ,
.Ql md5
�Ǥ���
.Pp
.Fn crypt_set_format
�ؿ��ϻ��ꤹ��
.Fa string
�˽������ǥե���ȥ��󥳡��ɥե����ޥåȤ����ꤷ�ޤ���
.Pp
�������Х�ǥե���ȥե����ޥåȤϡ�
.Pa /etc/auth.conf
�ե�����ǡ�
.Va crypt_default
°����Ȥ����ꤹ�뤳�Ȥ��Ǥ��ޤ���
.Sh �����
.Fn crypt
�ϡ�����������������硢�Ź沽���줿�ͤ�ؤ��ݥ��󥿤��֤��ޤ���
���������Ԥ�����硢NULL ���֤��ޤ���
����: ������̾�ε�ư�ǤϤ���ޤ���
AT&T ��
.Fn crypt
�Ͼ��ʸ�����ؤ��ݥ��󥿤��֤��ޤ���
.Pp
.Fn crypt_set_format
.\"X will return 1 if the supplied encoding format was valid.
�ϡ�Ϳ����줿���󥳡��ɥե����ޥåȤ������Ǥ���С�1 ���֤��ޤ���
.\"X Otherwise, a value of 0 is returned.
����ʳ��ξ�硢�� 0 ���֤���ޤ���
.Sh ��Ϣ����
.Xr login 1 ,
.Xr passwd 1 ,
.Xr auth_getval 3 ,
.Xr cipher 3 ,
.Xr getpass 3 ,
.Xr auth.conf 5 ,
.Xr passwd 5
.Sh �Х�
.Fn crypt
�ؿ�����Ū�ǡ����ؤΥݥ��󥿤��֤��ޤ���
�����ơ��ʸ��
.Fn crypt
�θƤӽФ���Ʊ���ǡ������ѹ����ޤ���
.Fn crypt_set_format
��Ʊ�ͤ���Ū�ǡ������ѹ����ޤ���
.Sh ���
����������Ѥ���
.Fn crypt
�ؿ��ϡ�
.At v6
���о줷�ޤ�����
���ߤΥ��������
.Fn crypt
�ϡ�
.At v7
�ǤϤ�����о줷�ޤ�����
.Pp
.Tn DES
���������Υ����� (FreeSec 1.0) �ϡ�����ꥫ�罰��ΤߤǻȤ���
.Nx
libcrypt �Ź沽�饤�֥����Ф��ơ����Τ褦�ʾ㳲�Τʤ��֤������Ȥ���
����ꥫ�罰��γ��dz�ȯ����ޤ�����
.Sh ���
.An -nosplit
����
.An David Burren Aq [email protected]
�ˤ�äƽ񤫤�ޤ�����
���θ���ɲá������ϡ�
.An Poul-Henning Kamp ,
.An Mark R V Murray ,
.An Kris Kennaway ,
.An Brian Feldman ,
.An Paul Herman ,
.\"X and
.An Niels Provos
�ˤ�äƹԤʤ��ޤ�����