SONET Scrambling
This is line coding, not Encryption !!!
A lot of people do not know this . . . but SONET and SDH data is scrambled just before it is placed on the fiber link. This is really not for encryption . . . rather, it is done for the same reason that B8ZS line coding is used for T1's and B3ZS line coding is used with T3's . . . where "1's density" is assured by the line coding so that the receiving unit does not encounter a long series of consecutive 0's and thereby losing synch. However, in the case of SONET and SDH, the scrambler insures that the receiving unit will not receive both a long series of 1's, or a long series of 0's.
If scrambling is enabled, both ends of the link must be configured to support scrambling. If only one end of the link is configured to enable scrambling, no connection is established.
NOTE: scrambling is not performed on the A1, A2, and C1 bytes !!! The output is NRZ encoded.

The STM-N (N = 0, 1, 4, 16, 64, 256) signal must have sufficient bit timing content at the NNI. A suitable bit pattern, which prevents a long sequence of "1"s or "0"s is provided by using a scrambler [polynomial: 1 + X6 + X7]. The STM-N signal is scrambled with a frame synchronous scrambler, of length 127, operating at the line rate.

SDH Scrambler