Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > opensslライブラリ > OpenSSL::Digestクラス
クラスの継承リスト: OpenSSL::Digest < Digest::Class < Object < Kernel < BasicObject
ハッシュ関数のためのインターフェースを提供するクラスです。
このインターフェースには2通りの利用法が存在します。 一方は文字列から直接ハッシュを計算する (OpenSSL::Digest.digest, Digest::Instance#hexdigest) 方法です。短い文字列の ダイジェストを取るときにはこちらを使えばよいでしょう。
もう一つはダイジェストオブジェクトを作成して、文字列を順次 OpenSSL::Digest#update で渡すことでダイジェストを計算 します。大きなファイルのハッシュ値を計算する場合などに 利用します。
例:
require 'openssl' digest = OpenSSL::Digest.new("sha256") File.open(filename){|f| while data = f.read(1024) digest.update(data) end } puts digest.hexdigest
digest も参照してください。
定義 | 説明 | |
---|---|---|
digest(name, data) -> String
|
data のダイジェストを計算します。 |
|
new(name, data=nil) -> OpenSSL::Digest
|
ダイジェストオブジェクトを生成します。 |
定義 | 説明 | |
---|---|---|
update(data) -> self
|
data でダイジェストオブジェクトの内部状態を更新します。 |
|
block_length -> Integer
|
ハッシュ関数のブロックサイズを返します。 |
|
digest_length -> Integer
|
ハッシュ値の長さ(バイト数)を返します。 |
|
name -> String
|
ハッシュ関数の名前を返します。 |
|
reset -> self
|
ダイジェストオブジェクトの内部状態をリセットします。 |
!
!=
==
===
=~
__id__
__send__
_dump
class
clone
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_s
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