This program performs a bitwise XOR operation on the contents of two files using AVX2 instructions for efficient processing. It's written in Go, utilizing cgo to integrate AVX2-based operations written in C for enhanced performance.
- Go (1.21 or later recommended)
- GCC compiler (for cgo to compile C code)
- Clone the repository to your local machine:
git clone https://github.com/qnfm/xor.git- Navigate to the cloned repository:
cd xor- Compile the program:
go build -o xorxor <input file 1> <input file 2> <output file>Replace <input file 1>, <input file 2>, and with the paths to your input files and the desired output file path, respectively. Note that the input files must be of the same size.
go test -benchmem -bench=.The program reads the contents of two files into memory, performs a bitwise XOR operation between each corresponding byte in the files using AVX2 instructions, and writes the result to an output file. This is achieved by embedding C code in the Go program using cgo, allowing for the use of AVX2 instructions for the XOR operation.
Contributions are welcome! If you have suggestions for improvements or encounter any issues, please open an issue or submit a pull request.