* Performs encode or decode on given content. * @protected * @param {Chain} content * @param {boolean} isEncode True for encoding, false for decoding * @return {number[]|string|Uint8Array|Chain|Promise} Resulting content
(content, isEncode)
| 79 | * @return {number[]|string|Uint8Array|Chain|Promise} Resulting content |
| 80 | */ |
| 81 | performTranslate (content, isEncode) { |
| 82 | const bytes = content.getBytes() |
| 83 | const operandBytes = this.getSettingValue('operand') |
| 84 | let operation = this.getSettingValue('operation') |
| 85 | |
| 86 | if (!isEncode) { |
| 87 | // Inverse operation |
| 88 | operation = operationInverseMap[operation] |
| 89 | } |
| 90 | |
| 91 | // Perform operation on each byte |
| 92 | return bytes.map((byte, index) => |
| 93 | this.performByteOperation(byte, operation, |
| 94 | operandBytes[index % operandBytes.length])) |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Performs given bitwise operation on a single byte. |
nothing calls this directly
no test coverage detected