An apparatus generates a scrambling code in a mobile communication system
by performing one or more mask operations on an input state value. The
apparatus includes a register memory which receives the state value from
an upper layer of the system, a generator which generates an extended
state value by performing a mask operation based on initial values of the
state value, and a code generator which generates a scrambling code based
on at least a first state value which is continuously selected from among
the extended state value, a second state value generated based on at
least state values (L,R) which correspond to the first state value, and
an initial value which has not been used from the initial values.