MCPcopy Index your code
hub / github.com/Print3M/ByteCaster / mac

Method mac

encoding/encoding.go:87–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85}
86
87func (e *encoder) mac() {
88 /*
89 MAC-fuscation:
90 "fc-48-83-e4-f0-e8\0" + "fc-48-83-e4-f0-e8\0" + "fc-48-83-e4-f0-e8\0"
91 */
92 NUM_OF_BYTES := 6
93
94 var result []byte
95 rest := len(e.input) % NUM_OF_BYTES
96
97 for i := 0; i < len(e.input)-rest; i += NUM_OF_BYTES {
98 ip := net.HardwareAddr(e.input[i : i+NUM_OF_BYTES]).String()
99 bytes := append([]byte(ip), 0x00)
100 e.output = append(e.output, bytes...)
101 }
102
103 if rest == 0 {
104 e.output = result
105 return
106 }
107
108 length := len(e.input)
109 lastBytes := e.input[length-(NUM_OF_BYTES-rest):]
110
111 for range rest {
112 lastBytes = append(lastBytes, 255)
113 }
114
115 lastIp := net.HardwareAddr(lastBytes).String()
116 bytes := append([]byte(lastIp), 0x00)
117
118 e.output = append(e.output, bytes...)
119}

Callers 1

EncodeDataFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected