Commit 2e0fae21 authored by Luc Libralesso's avatar Luc Libralesso
Browse files

start implementing mixColumnOperator

parent e95d2378
......@@ -53,17 +53,24 @@ class SOperator < CryptoOperator
end
end
# ## MixColumns operator
# class MixColumnsOperator < CryptoOperator
# def initialize(inputs, outputs, m)
# raise "MixColumnsOperator: inputs should be of size 4 (current size: #{inputs.length})" unless inputs.length == 4
# raise "MixColumnsOperator: outputs should be of size 4 (current size: #{outputs.length})" unless outputs.length == 4
# @m = m
# super(inputs:inputs, outputs:outputs)
# end
# def compute_call(inputs)
# raise "MixColumnsOperator: inputs should be of size 4 (current size: #{inputs.length})" unless inputs.length == 4
# end
# end
# end
## MixColumns operator
class MixColumnsOperator < CryptoOperator
##
# @params inputs [Vec<u8>] 4 byte input
# @params outputs [Vec<u8>] 4 byte output
# @params m [Vec<Vec<u8>>] mixcolumns matrix
def initialize(inputs, outputs, m)
raise "MixColumnsOperator: matrix dimensions should be of the same size of the input (current y size: #{m.length})" unless inputs.length == m.length
raise "MixColumnsOperator: matrix dimensions should be of the same size of the input (current x size: #{m.first.length})" unless inputs.length == m.first.length
raise "MixColumnsOperator: output dimensions should be of the same size of the input (current size: #{outputs.length})" unless inputs.length == outputs.length
@m = m
super(
inputs: inputs,
outputs: outputs,
constraint: Equality.new(
# TODO(all) add And or ForEach constraint to "mix" all inputs and outputs
)
)
super(inputs:inputs, outputs:outputs)
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment