Two points are important here: 
  • Maximum number of shift register (N) 
  • Mask
  • The period of out put sequence is 2N-1 bits
  • Only sequence offset is change when the mask is changed
  • PN stands for Pseudorandom Noise sequence
In CDMA system, user information is encrypted by means of scrambling. The scramble code used here is M-sequence. Shown in the figure is an M-sequence generator made up of a shifting register sequence and a mask. 
The period of the output sequence is 2N-1 (N being the number of shifting registers). That is to say, the shifting register sequence resumes to the initial status when every 2N-1 pieces of codes are output. In a CDMA system, there are two kinds of M-sequence, one being the long code with its period of 242-1 and the other being the short code with its period of 215-1. Used for scrambling is the long code while used for subsequent demodulation is the short code.
It can be seen that for different masks, a shifting register sequence outputs different M-sequences, which we call different phases. Actually, different masks in CDMA are allocated to different users,who are enabled to obtain different M-sequences.