Below you find my little algorithm (written in ARIBAS) to generate an double-even magic square of side length n (ie 4 divides n);
example for n = 4; for simplicity of the algorithm, a 'vector' is used to store the 'square'
MagicSquareDoubleEven(4).
-: (16, 2, 3, 13, 5, 11, 10, 8, 9...