C# realisation of Berlekamp–Massey algorithm