nbdkit-xor-filter - obfuscate contents of a plugin with XOR
nbdkit --filter=xor [PLUGIN ARGS ...] xor=VALUE xorlen=LENBYTES
nbdkit-xor-filter is a filter for nbdkit(1) which XORs (exclusive or) a value across all of the data in the underlying plugin. This can be used to obfuscate the contents of a plugin or as a trivial, insecure, but fast type of encryption. For proper encryption, see nbdkit-luks-filter(1).
nbdkit file disk.img --filter=xor xor=0xDEADBEEF xorlen=4
This filter does not currently support sparse plugins. Trim operations will fill the backing plugin with XORed zeroes (which makes it trivial to read out the "key", another reason why this is not secure).
The value to be XORed with the underlying data. This is truncated or extended to xorlen bytes. Usually you want to specify this in hex using the 0x prefix.
The value is big endian. For example xor=0x123456 xorlen=3 will XOR bytes as follows:
data: A0 A1 A2 A3 A4 A5 A6
XOR with: 12 34 56 12 34 56 12
────────────────────
result: B2 95 F4 B1 90 F3 B4
This parameter is required.
The length of the XOR value, in bytes. Any length from 1 to 8 is supported.
This parameter is required.
The filter.
Use nbdkit --dump-config to find the location of $filterdir.
nbdkit-xor-filter first appeared in nbdkit 1.48.
nbdkit(1), nbdkit-file-plugin(1), nbdkit-luks-filter(1), nbdkit-pattern-plugin(1), nbdkit-swab-filter(1), nbdkit-filter(3), nbdkit_parse_uint64_t(3).
Richard W.M. Jones
Copyright Red Hat
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.