Module: Digest

Defined in:
digest.c,
lib/digest.rb,
sha2/lib/sha2.rb,
digest.c

Overview

This module provides a framework for message digest libraries.

Defined Under Namespace

Modules: Instance Classes: Base, Class, MD5, RMD160, SHA1, SHA2

Class Method Summary collapse

Class Method Details

.bubblebabble(string) ⇒ Object

Returns a BubbleBabble encoded version of a given string.



87
88
89
90
91
# File 'bubblebabble/bubblebabble.c', line 87

static VALUE
rb_digest_s_bubblebabble(VALUE klass, VALUE str)
{
    return bubblebabble_str_new(str);
}

.const_missing(name) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/digest.rb', line 4

def self.const_missing(name)
  case name
  when :SHA256, :SHA384, :SHA512
    lib = 'digest/sha2.so'
  else
    lib = File.join('digest', name.to_s.downcase)
  end

  begin
    require lib
  rescue LoadError => e
    raise LoadError, "library not found for class Digest::#{name} -- #{lib}"
  end

  Digest.const_get(name)
end

.hexencode(string) ⇒ Object

Generates a hex-encoded version of a given string.



73
74
75
76
77
# File 'digest.c', line 73

static VALUE
rb_digest_s_hexencode(VALUE klass, VALUE str)
{
    return hexencode_str_new(str);
}