continuity/scripts/dexor_binary_file.ps1

14 lines
397 B
PowerShell

$SourceFilePath = $args[0]
$DestinationFilePath = $args[1]
$XorKey = [byte]$args[2]
# Load the binary data from the file
$data = [System.IO.File]::ReadAllBytes($SourceFilePath)
# Apply the XOR operation
for ($i = 0; $i -lt $data.Length; $i++) {
$data[$i] = $data[$i] -bxor $XorKey
}
# Write the output to the destination file
[System.IO.File]::WriteAllBytes($DestinationFilePath, $data)