|
|
|
@ -16,8 +16,9 @@ func (x xor) obfuscate(data []byte) *ast.BlockStmt {
|
|
|
|
|
key := make([]byte, len(data))
|
|
|
|
|
genRandBytes(key)
|
|
|
|
|
|
|
|
|
|
op := genRandOperator()
|
|
|
|
|
for i, b := range key {
|
|
|
|
|
data[i] = data[i] ^ b
|
|
|
|
|
data[i] = evalOperator(op, data[i], b)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &ast.BlockStmt{List: []ast.Stmt{
|
|
|
|
@ -40,11 +41,7 @@ func (x xor) obfuscate(data []byte) *ast.BlockStmt {
|
|
|
|
|
&ast.AssignStmt{
|
|
|
|
|
Lhs: []ast.Expr{ah.IndexExpr("data", ah.Ident("i"))},
|
|
|
|
|
Tok: token.ASSIGN,
|
|
|
|
|
Rhs: []ast.Expr{&ast.BinaryExpr{
|
|
|
|
|
X: ah.IndexExpr("data", ah.Ident("i")),
|
|
|
|
|
Op: token.XOR,
|
|
|
|
|
Y: ah.Ident("b"),
|
|
|
|
|
}},
|
|
|
|
|
Rhs: []ast.Expr{getReversedOperator(op, ah.IndexExpr("data", ah.Ident("i")), ah.Ident("b"))},
|
|
|
|
|
},
|
|
|
|
|
}},
|
|
|
|
|
},
|
|
|
|
|