class CryptoToolchain::BlackBoxes::MD4Mac
Attributes
key[R]
Public Class Methods
new(key: Random.new.bytes(16))
click to toggle source
# File lib/crypto_toolchain/black_boxes/md4_mac.rb, line 6 def initialize(key: Random.new.bytes(16)) @key = key end
Public Instance Methods
mac(str)
click to toggle source
# File lib/crypto_toolchain/black_boxes/md4_mac.rb, line 10 def mac(str) concat = key + str CryptoToolchain::Utilities::MD4.hexdigest(concat) end
valid?(message: , mac: )
click to toggle source
# File lib/crypto_toolchain/black_boxes/md4_mac.rb, line 15 def valid?(message: , mac: ) self.mac(message) == mac end