Skip to content

NhanAZ-Web/invisible-prompt-injection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Invisible Prompt Injection

A web tool for embedding and inspecting hidden payloads inside ordinary text using zero-width Unicode characters.

Binary encoding

Bit value Character Codepoint
0 Zero Width Space U+200B
1 Zero Width Non-Joiner U+200C

Bytes are emitted MSB-first (bit 7 → bit 0 per byte).

Packet format (v2)

  1. Prefix (4 code units, not part of the bit stream): U+200D U+2060 U+200D U+2060 (ZWJ, Word Joiner, ZWJ, Word Joiner).
  2. Bit stream from bytesToBitChars(packetBytes) where packetBytes is:
Offset Size Content
0 4 Magic 0x49 0x50 0x49 0x31 (IPI1)
4 4 Payload length (big-endian uint32, byte length of UTF-8 payload)
8 4 FNV-1a 32-bit checksum over the payload bytes only
12 n UTF-8 payload (n = length field)

FNV-1a (32-bit): offset basis 0x811C9DC5, prime 0x01000193; for each payload byte: hash = (hash XOR byte) * prime (unsigned 32-bit).

Composition: visibleText + prefix + bitChars(packetBytes).

Decoding order

  1. With prefix: Find the prefix substring; read the longest contiguous run of only U+200B/U+200C; interpret as bytes; validate magic, length, and checksum; strip consumed bit length from the string.
  2. Without prefix: Globally match runs [\u200B\u200C]{96,}; for each match, try the same packet parse (covers stripped prefix).
  3. Legacy v1: Payload bits lie between start U+2063 U+2062 U+2063 and end U+2062 U+2063 U+2062 (no IPI1 header - raw UTF-8 bytes as bit stream).

Invalid checksum or truncated length yields a failed parse; the implementation may continue searching (prefix path) or skip to the next candidate (prefixless).