/* Global assumption:
E<e> := GF(2,6);
V6 := VectorSpace(GF(2), 6);
V24 := VectorSpace(GF(2), 24); */

TypicalRound := function(a, lambda, k)

	a := Divide(a,4);
	a := Matrix(E, 1, 4, [Vector2Element(a[1]), Vector2Element(a[2]), Vector2Element(a[3]), Vector2Element(a[4])]);

	a := SB(a);
	
	a := a * lambda;
	a := Matrix(GF(2), 4, 6, [Element2Vector(a[1][1]), Element2Vector(a[1][2]), Element2Vector(a[1][3]), Element2Vector(a[1][4])]);	
	a := V24!Join(a);

	a := a  + k;

	return a;
end function;

Encode := function(a, W)
	local lambda, k;

	lambda := MatrixLambdaRSC(64, 4, 12);	
	k := KeyScheduleStep3(W, 1);
	a := a + k;
	for nround in [1..15] do
		k := KeyScheduleStep3(W, nround + 1);
		a := TypicalRound(a, lambda, k);
	end for;

	return a;
end function;

BunnyTN := function(m, k)
	local W;

	W := KeyScheduleStep1(k);
	W := KeyScheduleStep2(W, 15);
		
	return Encode(m, W);
end function;