A method and apparatus for generating a keystream are provided. The method
includes: (a) receiving a bitstream comprised of at least 4 bits; (b)
selecting at least two bits from the received bitstream; (c) generating
an operation value by performing a predetermined bitwise operation on the
bits selected in (b); and (d) determining whether to discard the received
bitstream or to output the rest of the received bitstream not selected in
(b) according to the operation value. The method and apparatus for
generating a keystream are expected to be suitable for a ubiquitous
computing and network environment and to provide high security or high
efficiency.