# AES MDS D-XOR and S-XOR count

I am trying to implement the D-XOR and S-XOR count in python but despite reading multiple articles on how to perform the calculation I have failed to understand the process used. I would appreciate it if someone could demonstrate the process using an example. Below I have included some of the references that detail the process.

GF(256)

MDS=[[2, 3, 1, 1],
[1, 2, 3, 1],
[1, 1, 2, 3],
[3, 1, 1, 2]]


Generator Coefficients=100011011
Generator Polynomial = x^8 + x^4 + x^3 + x^1 + 1


references:

• That MDS matrix looks wrong; it should have 4 4's, not only 2 of them. And, no MDS matrix has a 2x2 submatrix of only 1's Nov 5 '20 at 18:56
• @poncho you were right about the 2x2 submatrix of 1's. I reviewed my code and noticed that the sliding window mechanism had a step size of 2 which would cause issues when filtering out invalid MDS matrices. Thank you for your comment!!! Nov 5 '20 at 21:27