A device and method of applying a parity to encrypt data for protection is disclosed. A parity generator generates a parity bit in accordance with a data to be outputted. A first parity location generator generates an inserting position N for the parity bit in accordance with a predetermined algorithm. A parity-inserting unit inserts the parity bit in a position between (N-1)th- and Nth-bit of the data in accordance with the inserting position N, thereby generating an encrypted data.
A device for applying a check bit to encrypt instructions for protection includes a check-bit generator, a first check-bit location generator and a check-bit insertion unit. The check-bit generator generates a check bit in accordance with an instruction with a plurality of bits to be outputted. The first check-bit location generator generates an insertion position N (positive integer) for the check bit in accordance with the instruction and a predetermined algorithm. The check-bit insertion unit inserts the check bit in a position between (N-1)th-and Nth-bit of the instruction in accordance with the insertion position N generated by the first check bit location generator, thereby generating an encrypted instruction.