An adaptive modified two-dimensional time-spreading/ wavelength-group-hopping embedded M-sequence code (TS/WGH embedded M-sequence code) is proposed for enhancing the cardinality, confidentiality, and bit error rate (BER) of synchronous networks. The proposed arrayed-waveguide-grating (AWG)-based modified TS/WGH embedded M-sequence encoder/decoder (codecs) is constructed by using a fine AWG to generate an M-sequence code pattern and then using multiple-coarse AWGs to spread this pattern in the wavelength domain. The signals produced by the coarse AWGs are then spread in the time domain using optical delay lines. In addition, an algorithm based on an anticipative-warning-time mechanism and a degree of weighted load balance (DWLB) policy is proposed for changing the signature address code word of each user on a sufficiently frequent basis in order to thwart synchronous-network attacks by eavesdroppers. Overall, the simulation results show that, compared to conventional two-dimensional prime-hop code (PHC) and modified PHC and previous TS/group-hopping embedded M-sequence code, the proposed adaptive modified TS/WGH embedded M-sequence code proposed in this study yields an effective reduction in the multiple-access interference and BER while simultaneously improving the degree of confidentiality. C 2011 Society of Photo-Optical Instrumentation Engineers (SPIE).