package main import ( "fmt" "math/big" ) func main() { x := big.NewInt(123) y := big.NewInt(456) z := new(big.Int).Xor(x, y) fmt.Printf("%b\n", x) // Prints "1111011" fmt.Printf("%b\n", y) // Prints "111001000" fmt.Printf("%b\n", z) // Prints "110100011" }
package main import ( "fmt" "math/big" ) func main() { x := big.NewInt(0xFFFFFFFF) y := big.NewInt(0xA5A5A5A5) z := new(big.Int).Xor(x, y) fmt.Printf("%x\n", x) // Prints "ffffffff" fmt.Printf("%x\n", y) // Prints "a5a5a5a5" fmt.Printf("%x\n", z) // Prints "5a5a5a5a" }In this example, we perform a bitwise XOR operation between two `big.Int` values that represent hexadecimal numbers. The result is stored in a new `big.Int` value called `z`. We then print the hexadecimal representation of each value to verify that the operation was performed correctly. In both of these examples, the `Xor` function is used to perform a bitwise XOR operation between two `big.Int` values. This function is part of the `math/big` package in Go.