A cipher engine performs cipher processing (encrypting/decrypting) on
logical data streams in a physical data stream in a storage device. As
the physical data stream changes from a first logical data stream to a
second logical data stream, and the cipher engine switches from cipher
processing the first logical data stream to the second logical data
stream, cipher information of the first logical data stream is stored in
a cipher state memory, cipher information of the second logical data
stream is retrieved from the cipher state memory, and the cipher engine
resumes cipher processing the second logical data stream using the cipher
information of the second logical data stream. Advantageously, a
virtually unlimited number of logical data streams is supported and
duplicate cipher hardware is avoided.