Scrambling scheme for non-MPEG audio formats

This scrambling scheme is provided for non-MPEG audio formats where the unsynchronisation scheme defined by the ID3v2 specifications is unsuitable. Each bit of the audio data is scrambled by taking the exclusive-OR (XOR) between it and the equivalent bit of a pseudo-random byte sequence. The first byte of this pseudo-random byte sequence is always %11111110 and is used to scramble the first byte of the audio data. The next byte of the sequence is derived from the current byte of the sequence using the algorithm in Table 1 and is used to scramble the next byte of audio data. This process is repeated until all bytes in the audio clip have been scrambled.

Table 1: Scrambling sequence algorithm

byte N+1

byte N

bit 7 =

bit 6 XOR bit 5

bit 6 =

bit 5 XOR bit 4

bit 5 =

bit 4 XOR bit 3

bit 4 =

bit 3 XOR bit 2

bit 3 =

bit 2 XOR bit 1

bit 2 =

bit 1 XOR bit 0

bit 1 =

bit 7 XOR bit 5

bit 0 =

bit 6 XOR bit 4

This algorithm results in a 127-bit pseudo-random sequence which repeats on byte boundaries every 127 bytes. To recover the audio data from the scrambled data the scrambling procedure is repeated.