Method and apparatus for generating key stream for stream cipher, s-box for block cipher and method for substituting input vector using the s-box

Key sequence generation method and apparatus for the stream cipher. This substitution method in the S-box, and the S-box is disclosed for a block cipher. Key sequence generation method for a stream cipher in accordance with the present invention, a pseudo-random vector from N- stage linear feedback shift register (LFSR) for generating a random number sequence that represents a respective state value of n (2≤n≤N) stages receiving input; And it characterized in that it comprises a step of outputting a key sequence by using the logarithmic function on the finite field of a circle of finite sigeun corresponding to the vector space representative of the vectors below. According to the present invention it is possible to obtain a high non-linear assist immune doeul optimal number.