cipher.go (944B)
1 // Copyright 2024 The Untangled Authors. Use of this source code is 2 // governed by the ISC license available in the LICENSE.ISC file. 3 4 package scte35 5 6 // Cipher is a 6-bit field specifying the algorithm used to encrypt 7 // payloads as defined in SCTE 35 section 11.3. 8 type Cipher uint8 9 10 const ( 11 CipherNone Cipher = iota 12 DES_ECB // SCTE 35 section 11.3.1 13 DES_CBC // SCTE 35 section 11.3.2 14 TripleDES // SCTE 35 section 11.3.3 15 reserved 16 // Values 32 through 63 are available for "User private" 17 // algorithms. See SCTE 35 section 11.3.4. 18 ) 19 20 const maxCipher = 63 21 22 func (c Cipher) String() string { 23 switch c { 24 case CipherNone: 25 return "none" 26 case DES_ECB: 27 return "DES – ECB mode" 28 case DES_CBC: 29 return "DES – CBC mode" 30 case TripleDES: 31 return "Triple DES EDE3 – ECB mode" 32 } 33 if c >= reserved && c <= 31 { 34 return "reserved" 35 } else if c <= maxCipher { 36 return "user private" 37 } 38 return "invalid" 39 }