The method of preventing illegal copy of contents encrypts a header using
a key generated from the previous sector, performs variable-length coding
to the encrypted header to shorten its length, and stores the decoded
header into the recording medium as well as contents data, in encryption
phase. The method, in decryption phase, reproduces the contents data
which have different length for each sector by decoding and encoding the
header.