The Berlekamp-Massey algorithm is a algorithm for finding the shortest linear feedback shift register (LFSR) for a given output sequence.