Class: Anyhash

Inherits:
Object
  • Object
show all
Defined in:
lib/anyhash.rb,
lib/anyhash/version.rb

Defined Under Namespace

Modules: Algorithms

Constant Summary collapse

VERSION =
'0.0.1'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Anyhash

Returns a new instance of Anyhash.



10
11
12
# File 'lib/anyhash.rb', line 10

def initialize(message)
  @message = message
end

Class Method Details

.gost(message) ⇒ Object



22
23
24
# File 'lib/anyhash.rb', line 22

def self.gost(message)
  new(message).hash(Anyhash::Algorithms::GOST)
end

.gost_cryptopro(message) ⇒ Object



26
27
28
# File 'lib/anyhash.rb', line 26

def self.gost_cryptopro(message)
  new(message).hash(Anyhash::Algorithms::GOST_CRYPTOPRO)
end

Instance Method Details

#hash(type) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/anyhash.rb', line 14

def hash(type)
  create_tempfile
  write_message_to_tempfile
  hash = calculate_tempfile_hash_for(type)
  delete_tempfile
  hash
end