I've studied linear cryptanalysis, but i don't think I have it very clear. I've the following doubt: I've constructed a "cryptographic" hash function for an exercise, and now i want to show summarily that is secure from "linear cryptanalysis".
My idea was simply to create a linear approximation like this:
X_1 XOR X_2 XOR ... X_n XOR Y_1 XOR Y_2 XOR ... Y_m
which involves the input and the output (whose bits X_i, Y_j respectively, are XOR together) of my hash function, and for a very large set of random input (about 1000000), to count how many times the result of this operation was 0, and how many time was 1. Then if the number of 0 does not differ much from the number of 1 (i.e. with probability about 0.5 the result is 1, and with probability about 0.5 the result is 0), my function it's ok, otherwise it's not secure.
My doubt is: Is this method right? What bits of the input and output i have to include in the linear approximation, all?
PS: I don't have to do linear cryptanalysis but only a very general analysis based on it.