MCPcopy Create free account
hub / github.com/cryptii/cryptii / performDecode

Method performDecode

src/Encoder/BifidCipher.js:87–101  ·  view source on GitHub ↗

* Performs decode on given content. * @protected * @param {Chain} content * @return {number[]|string|Uint8Array|Chain} Decoded content

(content)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 4

encodeMethod · 0.80
getCodePointAtMethod · 0.80
decodeMethod · 0.80
getLengthMethod · 0.45

Tested by

no test coverage detected