MCPcopy Create free account
hub / github.com/TideSec/GoBypassAV / decode

Function decode

Encryption/Bagua_code/main.go:66–88  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

64}
65
66func decode(s string) ([]byte, error) {
67 if s == "" {
68 return nil, nil
69 }
70
71 sl := len(s)
72
73 is := make([]int, sl)
74 for i := 0; i < sl/3; i++ {
75 b, ok := m2[s[i*3:i*3+3]]
76 if !ok {
77 return nil, errors.New("invalid string, cur: " + strconv.Itoa(i))
78 }
79 copy(is[i*3:i*3+3], b[:])
80 }
81
82 buf := make([]byte, sl/8)
83 for i := 0; i < sl/8; i++ {
84 buf[i] = b8ToByte(is[i*8 : i*8+8])
85 }
86
87 return buf, nil
88}
89
90func b8ToByte(b []int) byte {
91 return byte(b[0]<<7 + b[1]<<6 + b[2]<<5 + b[3]<<4 + b[4]<<3 + b[5]<<2 + b[6]<<1 + b[7])

Callers 1

Bagua_deFunction · 0.85

Calls 1

b8ToByteFunction · 0.85

Tested by

no test coverage detected