* Performs decode on given content. * @protected * @param {Chain} content * @return {number[]|string|Uint8Array|Chain} Decoded content
(content)
| 85 | * @return {number[]|string|Uint8Array|Chain} Decoded content |
| 86 | */ |
| 87 | async performDecode (content) { |
| 88 | const sourcePolybius = await this._polybiusSquare.encode(content) |
| 89 | const polybiusLength = sourcePolybius.getLength() |
| 90 | |
| 91 | // Transpose coordinates back |
| 92 | const resultPolybius = new Array(polybiusLength) |
| 93 | for (let i = 0; i < polybiusLength / 2; i++) { |
| 94 | resultPolybius[i * 2] = |
| 95 | sourcePolybius.getCodePointAt(i) |
| 96 | resultPolybius[i * 2 + 1] = |
| 97 | sourcePolybius.getCodePointAt(polybiusLength / 2 + i) |
| 98 | } |
| 99 | |
| 100 | return this._polybiusSquare.decode(resultPolybius) |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Triggered when a setting field has changed. |
nothing calls this directly
no test coverage detected