---
alias: user-guide-automation-converter-bufferbitwise
description: "This tool performs bitwise operations on binary data streams within a buffer"
---
# Buffer Bitwise
This converter applies bitwise operations to the value. Valid operations are AND (&), OR (\|), NOT (\~), Shift Left (\<\<), Shift Right (\>\>) without sign propagation. It also has the Mask that behaves the same as AND. It receives a Buffer object, which is an object capable of manipulating streams of binary.
## Settings
| Name | Data Type | Possible Values | Description |
| --------- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| operation | `Enum` | `AND`
`OR`
`NOT`
`Shift Left`
`Shift Right`
`Mask`
| Type of bitwise operation to perform over the input buffer |
| argument | `Integer` | | Argument to pass into the bitwise operation selected (example for `Shift Right`: `input` >> `argument`) |
Table 1: Settings
![image121][image121]
[image121]: ./images/image121.png
## Examples
Using a single-byte input buffer, each operation acts on the value bit-by-bit:
| Input (bin) | `operation` | `argument` | Output (bin) | Output (dec) |
| ----------- | ------------- | ----------- | ------------ | ------------ |
| `0000 1110` | `AND` | `3` | `0000 0010` | `2` |
| `0000 1000` | `Mask` | `0` | `0000 0000` | `0` |
| `0000 1110` | `OR` | `3` | `0000 1111` | `15` |
| `0000 1111` | `Shift Left` | `1` | `0001 1110` | `30` |
| `0000 1111` | `Shift Right` | `1` | `0000 0111` | `7` |
| `0000 1101` | `NOT` | *(ignored)* | `1111 0010` | `242` |
Table 2: Examples
### Invalid Input
This converter fails in any of the cases below. For what happens to the rest of the chain when a converter fails (the error is logged, reported for monitoring, and the next task does not run), see [[user-guide-automation-converters-index]].
| Input | `operation` | Result |
| ----------------------------- | ------------- | ---------------------------------------------------------------------- |
| Non-Buffer (e.g., `String`) | any | Fails with `Given input value is not an instance of a Buffer`. |
| Buffer longer than 6 bytes | any | Fails with `Invalid size of buffer ''. Must be up to 6 bytes long` |
| any Buffer | `UnknownOp` | Fails with `Unknown bitwise operation ''`. |
| `1000 0001` | `AND` with `argument` `128` | Fails with `The value of "value" is out of range. It must be >= -128 and <= 127. Received 128`. The result is written as a signed number of the input's length, so any result outside that range fails. |
Table 3: Invalid Input