Device and method for encryption and decryption and recording medium

A part of data is extracted as an IV from cipher text at the previous time. An EX-OR gate ORes the IV and a common key and outputs a cipher key. Data to be transmitted are encrypted with the cipher key according to stream cipher. When ciphered data 15 a are obtained at time tn-1, an IV extracted from the ciphered data 15 a is supplied to an EX-OR gate 11 b. The EX-OR gate 11 b exclusively ORes the IV and a common key 12 b and outputs a cipher key 13 b. Since the cipher key 13 b and transmission data are exclusively ORed, encryption is performed according to the stream cipher. As a result, ciphered data 15 b at time tn is obtained. Next, with the IV extracted from the ciphered data 15 b, encryption at time tn+1 is performed. Thereafter, at each time, a part of cipher text is used as an IV. The encrypting process is repeated.