Module: Diversion::Signing

Included in:
Decode, Encode
Defined in:
lib/diversion/signing.rb

Constant Summary collapse

MAX_SIGN_LENGTH =
32

Class Method Summary collapse

Class Method Details

.sign_data(sign_key, sign_length, data) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/diversion/signing.rb', line 9

def self.sign_data(sign_key, sign_length, data)
  sig = ""
  unless sign_length == 0
    raise Error::KeyMissingError.new unless sign_key
    sig = HMAC::MD5.new(sign_key).update(data).hexdigest[0..sign_length-1]
  end
  sig
end