A method for generating a scrambling code, comprising: acquiring initial sequences X0, Y0; characterized in the method further comprises: extending the initial sequences X0, Y0 for (└N/M┘+1) times, and obtaining extended sequences X*, Y*, wherein, the N is a positive integer, 0 < M ≦ 22, and "└ ┘" denotes rounded down; acquiring phase offset column vectors; and generating the scrambling code according to the extended sequences X*, Y* and the phase offset column vectors, wherein, the step of extending the initial sequences X0, Y0 for (└N/M┘+1) times, and obtaining the extended sequences X*, Y* comprises: making └N/M┘+1 be j, 0 < q ≤ j; and extending the initial sequences X0, Y0 for j times, so that the 0 th bit to the (24+M×(q-1)) th bit of a sequence Xq after the q th time' extension is the same as the 0 th bit to the (24+M×(q-1)) th bit of a sequence X(q-1) after the (q-1) th time' extension, the (25+M×(q-1)+k) th bit of the sequence Xq is a result by adding modulo 2 of the (M×(q-1)+k) th bit and the (M×(q-1)+k+3) th bit of the sequence X(q-1); and a sequence Yq after the q th time' extension is the same as the 0 th bit to the (24+M×(q-1)) th bit of a sequence Y(q-1) after the (q-1) th time' extension, the (25+M×(q-1)+k) th bit of the sequence Yq is a result by adding modulo 2 of the (M×(q-1)+k) th bit, the (M×(q-1)+k+1) th bit, the (M×(q-1)+k+2) th bit and the (M×(q-1)+k+3) th bit of the sequence Y(q-1); wherein, 0 ≦ k ≦ 21. acquiring initial sequences X0, Y0; characterized in the method further comprises: extending the initial sequences X0, Y0 for (└N/M┘+1) times, and obtaining extended sequences X*, Y*, wherein, the N is a positive integer, 0 < M ≦ 22, and "└ ┘" denotes rounded down; acquiring phase offset column vectors; and generating the scrambling code according to the extended sequences X*, Y* and the phase offset column vectors, extending the initial sequences X0, Y0 for (└N/M┘+1) times, and obtaining extended sequences X*, Y*, wherein, the N is a positive integer, 0 < M ≦ 22, and "└ ┘" denotes rounded down; acquiring phase offset column vectors; and generating the scrambling code according to the extended sequences X*, Y* and the phase offset column vectors, wherein, the step of extending the initial sequences X0, Y0 for (└N/M┘+1) times, and obtaining the extended sequences X*, Y* comprises: making └N/M┘+1 be j, 0 < q ≤ j; and extending the initial sequences X0, Y0 for j times, so that the 0 th bit to the (24+M×(q-1)) th bit of a sequence Xq after the q th time' extension is the same as the 0 th bit to the (24+M×(q-1)) th bit of a sequence X(q-1) after the (q-1) th time' extension, the (25+M×(q-1)+k) th bit of the sequence Xq is a result by adding modulo 2 of the (M×(q-1)+k) th bit and the (M×(q-1)+k+3) th bit of the sequence X(q-1); and a sequence Yq after the q th time' extension is the same as the 0 th bit to the (24+M×(q-1)) th bit of a sequence Y(q-1) after the (q-1) th time' extension, the (25+M×(q-1)+k) th bit of the sequence Yq is a result by adding modulo 2 of the (M×(q-1)+k) th bit, the (M×(q-1)+k+1) th bit, the (M×(q-1)+k+2) th bit and the (M×(q-1)+k+3) th bit of the sequence Y(q-1); wherein, 0 ≦ k ≦ 21. making └N/M┘+1 be j, 0 < q ≤ j; and extending the initial sequences X0, Y0 for j times, so that the 0 th bit to the (24+M×(q-1)) th bit of a sequence Xq after the q th time' extension is the same as the 0 th bit to the (24+M×(q-1)) th bit of a sequence X(q-1) after the (q-1) th time' extension, the (25+M×(q-1)+k) th bit of the sequence Xq is a result by adding modulo 2 of the (M×(q-1)+k) th bit and the (M×(q-1)+k+3) th bit of the sequence X(q-1); and a sequence Yq after the q th time' extension is the same as the 0 th bit to the (24+M×(q-1)) th bit of a sequence Y(q-1) after the (q-1) th time' extension, the (25+M×(q-1)+k) th bit of the sequence Yq is a result by adding modulo 2 of the (M×(q-1)+k) th bit, the (M×(q-1)+k+1) th bit, the (M×(q-1)+k+2) th bit and the (M×(q-1)+k+3) th bit of the sequence Y(q-1); wherein, 0 ≦ k ≦ 21.