The invention relates to a modular operation method with the variable bit width, and a modular operation circuit. Firstly, a modulus is shifted leftwards, the
left shifting result and the modulus are combined with the bit width of an
operand, N+1 intervals are formed according to the sequence from large to small, one bit is shifted leftwards, the minimum value of the first interval is subtracted from the
operand, and the size of the obtained result and the value is judged; when the result is greater than the value, the result is used for replacing the
operand to continue subtraction operation until the obtained result is smaller than the operand, then next interval operation is carried out, if the result is smaller than the operand at the beginning, the next interval is directly entered, the operation is repeated until the last interval is entered, subtraction and comparison operation is carried out, and modular operation is completed; and when
left shifting is carried out by two or more bits, the interval where the operand is located is judged, then the operand skips to the corresponding interval, and c subtraction and comparison operation are directly performed on the later interval according to the previous process; and corresponding circuits need to be configured with a plurality of shifters, registers, subtracters and selectors.