The Berlekamp—Massey algorithm is an algorithm for finding the shortest shift register with linear feedback for a binary sequence submitted to the input. The algorithm also allows you to find the minimum polynomial of a linear recurrent sequence submitted to the input over an arbitrary field.
Example: https://kramlex.github.io/algo-bm/