<div id="comment:0"></div> The function linear_branch_number() in sage.crypto.sbox.SBox produces incorrect result for a non-invertible SBox. For example, ``` sage: from sage.crypto.sbox import SBox sage: f = SBox([0, 2, 0, 6, 2, 2, 3, 7]) sage: f.linear_branch_number() 2 ``` The output should be equal to 1 instead of 2. Component: **cryptography** Keywords: **sbox** Author: **Rusydi H. Makarim** _Issue created by migration from https://trac.sagemath.org/ticket/29769_