Module: Digest

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

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.



# File 'bubblebabble/bubblebabble.c'

/*
 * call-seq:
 *     Digest.bubblebabble(string) -> bubblebabble_string
 *
 * Returns a BubbleBabble encoded version of a given _string_.
 */
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
20
21
# 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}", caller(1)
  end
  unless Digest.const_defined?(name)
    raise NameError, "uninitialized constant Digest::#{name}", caller(1)
  end
  Digest.const_get(name)
end

.hexencode(string) ⇒ Object

Generates a hex-encoded version of a given string.



# File 'digest.c'

/*
 * call-seq:
 *     Digest.hexencode(string) -> hexencoded_string
 *
 * Generates a hex-encoded version of a given _string_.
 */
static VALUE
rb_digest_s_hexencode(VALUE klass, VALUE str)
{
    return hexencode_str_new(str);
}