Release extension 3.2.0 with ZWUS-7 and large text support

This commit is contained in:
2026-09-16 16:50:56 -07:00
parent 2150671b97
commit d840ffd5f9
22 changed files with 3654 additions and 64 deletions

12
sig.js
View File

@@ -5,7 +5,7 @@ export const SIG_PREFIX = '\u{200D}\u{200B}\u{00AD}';
export const SIG = {
3: '\u{200D}\u{200B}\u{00AD}\u{180E}\u{200D}',
6: '\u{200D}\u{200B}\u{00AD}\u{200C}\u{200D}',
8: '\u{200D}\u{200B}\u{00AD}\u{200C}\u{200C}'
7: '\u{200D}\u{200B}\u{00AD}\u{200C}\u{200C}'
};
export const CIPHERS = {
@@ -28,16 +28,20 @@ export function makeSig(base, cipher) {
}
export function parseSig(text) {
if (!text.includes(SIG_PREFIX)) return null;
const base = Object.keys(SIG).find(b => text.includes(SIG[b]));
let sigIdx = text.indexOf(SIG_PREFIX), base;
while (sigIdx !== -1) {
base = Object.keys(SIG).find(b => text.startsWith(SIG[b], sigIdx));
if (base) break;
sigIdx = text.indexOf(SIG_PREFIX, sigIdx + SIG_PREFIX.length);
}
if (!base) return null;
const sigIdx = text.indexOf(SIG[base]);
const after = text.slice(sigIdx + SIG[base].length);
const barrier = zwus[base].unifier + zwus[base][0];
if (after.startsWith(barrier)) {
const zwDigits = Array.from(after.slice(barrier.length, barrier.length + 3));
const digits = zwDigits.map(z => Object.keys(zwus[base]).find(k => zwus[base][k] === z)).join('');
const cipher = CIPHERS[parseInt(digits, base)];
if (!cipher) return { base, cipher: 'PLAIN', payload: after, sigIdx, sigLen: SIG[base].length };
const payload = after.slice(barrier.length + 3);
const sigLen = SIG[base].length + barrier.length + 3;
return { base, cipher, payload, sigIdx, sigLen };