Class: Stribog::CompressionFunc

Inherits:
Object
  • Object
show all
Includes:
HashParams
Defined in:
lib/stribog/compression_func.rb

Overview

Compression

Class implements compression function of GOST R 34.11-2012 algorithm.

Author:

  • WildDima

Constant Summary

Constants included from HashParams

HashParams::CONSTANTS_C, HashParams::MATRIX_A, HashParams::PI, HashParams::T

Instance Method Summary collapse

Constructor Details

#initialize(n, message, hash_vector) ⇒ CompressionFunc

Returns a new instance of CompressionFunc.



9
10
11
12
13
# File 'lib/stribog/compression_func.rb', line 9

def initialize(n, message, hash_vector)
  @n = n
  @message = message
  @hash_vector = hash_vector
end

Instance Method Details

#callObject



15
16
17
18
19
20
# File 'lib/stribog/compression_func.rb', line 15

def call
  vector = lpsx_func @n, @hash_vector
  vector = func_e vector, @message
  vector = vector ^ @hash_vector
  vector ^ @message
end