Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > digestライブラリ > Digest::Baseクラス
クラスの継承リスト: Digest::Base < Digest::Instance < Digest::Class < Object < Kernel < BasicObject
すべての Digest::XXX クラスの基底クラス。
例えば、MD5 値を得るには以下のようにする。
require 'digest/md5' p Digest::MD5.hexdigest('abc') #=> '900150983cd24fb0d6963f7d28e17f72' p Digest::MD5.file('ruby-1.8.5.tar.gz').to_s #=> '3fbb02294a8ca33d4684055adba5ed6f'
すべての Digest::XXX クラスは以下の共通インタフェースを持つ。
定義 | 説明 | |
---|---|---|
digest(str)
|
与えられた文字列に対するハッシュ値を文字列で返す。 new(str).digest と等価。 |
|
file(path) -> object
|
新しいダイジェストオブジェクトを生成し、 ファイル名 file で指定したファイルの内容を読み込み、 そのダイジェストオブジェクトを返します。 |
|
hexdigest(str)
|
与えられた文字列に対するハッシュ値を、ASCIIコードを使って 16進数の列を示す文字列にエンコードして返す。 new(str).hexdigest と等価。 |
|
new
|
新しいダイジェストオブジェクトを生成する。 |
定義 | 説明 | |
---|---|---|
update(str)
|
文字列を追加する。self を返す。 複数回updateを呼ぶことは文字列を連結してupdateを呼ぶことと等しい。 すなわち m.update(a); m.update(b) は m.update(a + b) と、 m << a << b は m << a + b とそれぞれ等価 である。 |
|
self == md
|
与えられたダイジェストオブジェクトと比較する。 |
|
self == str
|
与えられた文字列を hexdigest 値と見て、自身の hexdigest 値と比較する。 |
|
block_length -> Integer
|
ダイジェストのブロック長を取得します。 例えば、Digest::MD5であれば64、Digest::SHA512であれば128です。 |
|
dup
|
ダイジェストオブジェクトの複製を作る。 |
|
digest -> String
|
updateや<<によって追加した文字列に対するハッシュ値を文字列で返します。 |
|
digest! -> String
|
updateや<<によって追加した文字列に対するハッシュ値を文字列で返します。 Digest::Base#digestと違い、 メソッドの処理後、 オブジェクトの状態を初期状態(newした直後と同様の状態)に戻します。 |
|
digest_length -> Integer
|
ダイジェストのハッシュ値のバイト長を取得する。 例えば、Digest::MD5であれば16、Digest::SHA1であれば20です。 |
|
file(path) -> self
|
ファイル名 file で指定したファイルの内容を読み込んでダイジェストを更新し、 オブジェクト自身を返します。 |
|
hexdigest -> String
|
updateや<<によって追加した文字列に対するハッシュ値を、 ASCIIコードを使って16進数の列を示す文字列にエンコードして返す。 |
|
hexdigest! -> String
|
updateや<<によって追加した文字列に対するハッシュ値を、 ASCIIコードを使って16進数の列を示す文字列にエンコードして返します。 Digest::Base#hexdigestと違い、 メソッドの処理後、 オブジェクトの状態を初期状態(newした直後と同様の状態)に戻します。 |
|
reset -> self
|
オブジェクトの状態を初期状態(newした直後と同様の状態)に戻し、 オブジェクト自身を返します。 |
!
!=
===
=~
__id__
__send__
_dump
class
dclone
display
enum_for
eql?
equal?
extend
freeze
frozen?
hash
initialize
initialize_copy
inspect
instance_eval
instance_exec
instance_of?
instance_variable_defined?
instance_variable_get
instance_variable_set
instance_variables
is_a?
marshal_dump
marshal_load
method
method_missing
methods
must_be
must_be_close_to
must_be_empty
must_be_instance_of
must_be_kind_of
must_be_nil
must_be_same_as
must_be_within_epsilon
must_equal
must_include
must_match
must_raise
must_respond_to
must_send
must_throw
nil?
pretty_inspect
pretty_print
pretty_print_cycle
pretty_print_inspect
pretty_print_instance_variables
private_methods
protected_methods
public_methods
remove_instance_variable
respond_to?
respond_to_missing?
singleton_class
singleton_method_added
singleton_method_removed
singleton_method_undefined
singleton_methods
taint
tainted?
tap
to_a
to_ary
to_hash
to_int
to_io
to_proc
to_regexp
to_str
to_yaml
to_yaml_properties
to_yaml_style
trust
untaint
untrust
untrusted?
wont_be
wont_be_close_to
wont_be_empty
wont_be_instance_of
wont_be_kind_of
wont_be_nil
wont_be_same_as
wont_be_within_epsilon
wont_equal
wont_include
wont_match
wont_respond_to