blob: 8997d25b9d1e26f6953b3d44f621787590e41141 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
.\" digest.txt.ja - -*- Indented-Text -*- created at: Fri May 25 08:22:19 JST 2001
$RoughId: digest.txt.jp,v 1.8 2001/07/13 15:38:27 knu Exp $
$Id$
** MD5(���饹)
RFC1321�˵��Ҥ���Ƥ���RSA Data Security, Inc. �� MD5 Message-Digest
Algorithm��������륯�饹��
Superclass: Digest::Base
require 'digest/md5'
** SHA1(���饹)
FIPS PUB 180-1�˵��Ҥ���Ƥ���NIST (the US' National Institute of
Standards and Technology) �� SHA-1 Secure Hash Algorithm��������륯�饹��
Superclass: Digest::Base
require 'digest/sha1'
** SHA256(���饹)
** SHA384(���饹)
** SHA512(���饹)
FIPS PUB 180-2�˵��Ҥ���Ƥ���NIST (the US' National Institute of
Standards and Technology) �� SHA-256/384/512 Secure Hash Algorithm��
�������륯�饹��
Superclass: Digest::Base
require 'digest/sha2'
** RMD160(���饹)
Hans Dobbertin, Antoon Bosselaers, Bart Preneel �ˤ�ä��߷פ��줿
RIPEMD-160 �ϥå���ؿ���������륯�饹��
Superclass: Digest::Base
require 'digest/rmd160'
�����Υ��饹�ϰʲ��Τ褦�ʶ��̤Υ����ե����������롣
Class Methods:
new([str])
�����������������ȥ��֥������Ȥ��������롥ʸ���������Ϳ������
�Ȥ�����ɲä���(see update)��
digest(str)
Ϳ����줿ʸ������Ф���ϥå����ͤ�ʸ������֤���
new(str).digest ��������
hexdigest(str)
Ϳ����줿ʸ������Ф���ϥå����ͤ�ASCII�����ɤ�Ȥä�
16�ʿ������ʸ����˥����ɤ����֤���
new(str).hexdigest ��������
Methods:
clone
�����������ȥ��֥������Ȥ�ʣ�����롣
digest
���ޤǤ��ɲä���ʸ������Ф���ϥå����ͤ�ʸ������֤���MD5�Ǥ�
16�Х���Ĺ��SHA1�����RMD160�Ǥ�20�Х���Ĺ��SHA256�Ǥ�32�Х���Ĺ��
SHA384�Ǥ�48�Х���Ĺ��SHA512�Ǥ�64�Х���Ĺ�Ȥʤ롣
hexdigest
to_s
���ޤǤ��ɲä���ʸ������Ф���ϥå����ͤ�ASCII�����ɤ�Ȥä�
16�ʿ������ʸ����˥����ɤ����֤���MD5�Ǥ�32�Х���Ĺ��
SHA1�����RMD160�Ǥ�40�Х���Ĺ��SHA256�Ǥ�64�Х���Ĺ��SHA384�Ǥ�
96�Х���Ĺ��SHA512�Ǥ�128�Х���Ĺ�Ȥʤ롣Ruby�ǽȰʲ���Ʊ����
def hexdigest
digest.unpack("H*")[0]
end
update(str)
<< str
ʸ������ɲä��롣ʣ����update��Ƥ֤��Ȥ�ʸ�����Ϣ�뤷��
update��Ƥ֤��Ȥ������������ʤ�� m.update(a); m.update(b) ��
m.update(a + b) �ȡ� m << a << b �� m << a + b �Ȥ��줾������
�Ǥ��롣
== md
Ϳ����줿�����������ȥ��֥������Ȥ���Ӥ��롣
== str
Ϳ����줿ʸ����� digest �͡��⤷���� hexdigest �ͤ���Ӥ��롣
��������ͤȸ��뤫��Ϳ����줿ʸ�����Ĺ���ˤ�äƼ�ưȽ��
����롣
-------------------------------------------------------
Local variables:
fill-column: 70
end:
|