VSRMark is a steganographic text encoding algorithm that hides a secret message inside ordinary-looking Unicode text using Unicode Variation Selectors.
VSRMark is implemented in multiple languages. Each implementation includes a test suite that validates encoding, decoding, round-trip correctness, capacity limits, and CRC integrity:
| Language | Implementation | Tests |
|---|---|---|
| C | C/vsrmark.c |
C/vsrmark_test.c |
| Go | Go/vsrmark.go |
Go/vsrmark_test.go |
| Java | Java/VSRMark.java |
Java/VSRMarkTest.java |
| Rust | Rust/src/lib.rs |
inline #[cfg(test)] module in lib.rs |
| Swift | Swift/Sources/VSRMark/VSRMark.swift |
Swift/Tests/VSRMarkTests/VSRMarkTests.swift |
| TypeScript | TypeScript/vsrmark.ts |
— |
This document describes the VSRMark steganographic text encoding algorithm that hides a secret message inside ordinary-looking Unicode text using Unicode Variation Selectors.
The algorithm encodes hidden data by converting a secret message into bytes and then mapping each byte to a Unicode Variation Selector. These variation selector characters are appended after visible characters in the carrier text. Because variation selectors usually do not visibly render on their own, the resulting text appears unchanged to a human reader while still carrying hidden data.
This technique is steganography, not encryption. The hidden message is concealed, but it is not cryptographically protected. Anyone who knows the encoding method can recover the hidden message.
Unicode Variation Selectors are code points used to request alternate visual forms of a preceding character. This algorithm repurposes them to store hidden data.
The key idea is:
One visible Unicode character can carry one hidden byte by appending one variation selector after it.
For example, conceptually:
Visible text:
Hello
Encoded text:
H[hidden byte]e[hidden byte]l[hidden byte]l[hidden byte]o[hidden byte]The variation selectors are present in the string, but they are usually invisible or visually insignificant.
The algorithm maps each possible byte value, from 0 to 255, to a unique Unicode Variation Selector.
There are two Unicode ranges used:
U+FE00 to U+FE0F
U+E0100 to U+E01EFThe mapping is:
Byte 0 → U+FE00
Byte 1 → U+FE01
...
Byte 15 → U+FE0F
Byte 16 → U+E0100
Byte 17 → U+E0101
...
Byte 255 → U+E01EFIn pseudocode:
function byteToVariationSelector(byte):
if byte < 16:
return codePoint(U+FE00 + byte)
return codePoint(U+E0100 + byte - 16)This gives exactly 256 possible variation selectors, which is enough to represent every possible byte.
The hidden message is not embedded directly. First, it is converted into a structured secret block.
The block format is:
Magic bytes | Version | Payload length | Payload | CRC32More specifically:
4 bytes - Magic value: "VSR1"
1 byte - Version number
2 bytes - Payload length, big-endian unsigned integer
N bytes - UTF-8 encoded secret message
4 bytes - CRC32 checksumThe complete structure is:
[0x56, 0x53, 0x52, 0x31] [0x01] [length_hi, length_lo] [payload] [crc32]The magic bytes spell:
VSR1The version byte is currently:
1The payload length is stored as a 16-bit unsigned integer, so the maximum hidden message size is:
65,535 UTF-8 bytesThe CRC32 checksum is calculated over everything except the checksum itself:
magic + version + length + payloadThis allows the decoder to verify that the recovered hidden message is valid.
The secret message is converted into UTF-8 bytes.
Example:
"Hi" → [0x48, 0x69]If the UTF-8 payload is longer than 65,535 bytes, encoding fails.
The encoder constructs the full hidden block:
header = magic + version + payloadLength
checksum = crc32(header + payload)
secretBlock = header + payload + checksumThe secret block contains both the message and enough metadata to recognize and validate it later.
Before embedding the new hidden data, the algorithm strips any existing variation selectors from the carrier text.
It removes characters from these ranges:
U+FE00 to U+FE0F
U+E0100 to U+E01EFThis prevents old hidden data from mixing with new hidden data.
The carrier text must contain enough visible Unicode characters to store the entire secret block.
Because each visible character can carry one byte, the required carrier length is:
secretBlock.lengthThe secret block has an 11-byte overhead:
4 bytes magic
1 byte version
2 bytes length
4 bytes CRC32
= 11 bytes overheadTherefore, a secret message of N UTF-8 bytes requires at least:
N + 11 visible charactersIf the carrier text is too short, the algorithm leaves it unchanged.
Step 5: Append Hidden Variation Selectors
The carrier text is split into Unicode characters.
For each visible character, the encoder appends one variation selector representing one byte from the secret block.
Pseudocode:
function encodeCarrierCharacters(carrier, secretBlock):
result = []
for each character at index i in carrier:
output = character
if i < secretBlock.length:
output = output + byteToVariationSelector(secretBlock[i])
result.push(output)
return join(result)Characters after the secret block has been fully embedded are left unchanged.
Step 1: Extract Hidden Bytes
The decoder scans the text for variation selectors.
Whenever it finds a variation selector, it converts it back into the byte it represents.
The reverse mapping is:
U+FE00 to U+FE0F → bytes 0 to 15
U+E0100 to U+E01EF → bytes 16 to 255Pseudocode:
function variationSelectorToByte(codePoint):
if codePoint is between U+FE00 and U+FE0F:
return codePoint - U+FE00
if codePoint is between U+E0100 and U+E01EF:
return 16 + (codePoint - U+E0100)
return undefinedThe result is a stream of recovered hidden bytes.
The decoder scans the recovered byte stream looking for the expected magic value and version:
"VSR1" + version 1In byte form:
0x56 0x53 0x52 0x31 0x01This allows the decoder to find the beginning of a valid hidden message, even if the text contains unrelated variation selectors.
Once the decoder finds the magic header, it reads the next two bytes as a big-endian unsigned 16-bit integer.
payloadLength = length_hi << 8 | length_loThis tells the decoder how many bytes to read as the hidden message payload.
The decoder calculates the payload boundaries:
payloadStart = start + 7
payloadEnd = payloadStart + payloadLength
crcStart = payloadEnd
crcEnd = payloadEnd + 4It then reads:
payload = bytes[payloadStart:payloadEnd]
storedCrc = bytes[payloadEnd:payloadEnd + 4]If the block is incomplete, the decoder ignores it and continues searching.
The decoder recomputes the CRC32 over:
magic + version + length + payloadIt compares the recomputed CRC32 to the stored CRC32.
If they match, the block is considered valid.
If they do not match, the decoder continues scanning for another possible valid block.
Once a valid block is found, the payload bytes are decoded as UTF-8.
The result is the recovered hidden message.
function encode(secretMessage, carrierText):
payload = UTF8Encode(secretMessage)
if payload.length > 65535:
throw error
magic = bytes("VSR1")
version = byte(1)
length = uint16BigEndian(payload.length)
header = magic + version + length
checksum = uint32BigEndian(crc32(header + payload))
secretBlock = header + payload + checksum
cleanedCarrier = removeVariationSelectors(carrierText)
if visibleCharacterCount(cleanedCarrier) < secretBlock.length:
return cleanedCarrier
result = ""
for i from 0 to cleanedCarrier.length - 1:
result += cleanedCarrier[i]
if i < secretBlock.length:
result += byteToVariationSelector(secretBlock[i])
return resultfunction decode(text):
hiddenBytes = []
for each codePoint in text:
byte = variationSelectorToByte(codePoint)
if byte is defined:
hiddenBytes.push(byte)
minimumLength = 11
for start from 0 to hiddenBytes.length - minimumLength:
if hiddenBytes[start:start+4] is not bytes("VSR1"):
continue
if hiddenBytes[start + 4] is not 1:
continue
payloadLength = uint16BigEndian(hiddenBytes[start + 5:start + 7])
payloadStart = start + 7
payloadEnd = payloadStart + payloadLength
blockEnd = payloadEnd + 4
if blockEnd > hiddenBytes.length:
continue
storedCrc = uint32BigEndian(hiddenBytes[payloadEnd:blockEnd])
actualCrc = crc32(hiddenBytes[start:payloadEnd])
if storedCrc == actualCrc:
return UTF8Decode(hiddenBytes[payloadStart:payloadEnd])
return undefinedThe algorithm stores:
1 hidden byte per visible Unicode characterHowever, the metadata overhead is 11 bytes.
Therefore:
maximum payload size = visible character count - 11For example:
100 visible characters → 89 bytes of usable hidden payload
1,000 visible characters → 989 bytes of usable hidden payload
10,000 visible characters → 9,989 bytes of usable hidden payloadThe payload limit is also capped at 65,535 bytes because the length field is two bytes.
This algorithm provides concealment, not cryptographic security.
It does not encrypt the hidden message. Anyone who knows the scheme can extract the variation selectors and decode the payload.
For sensitive data, the payload should be encrypted before being passed into this encoding algorithm.
Recommended security layering:
plaintext secret
→ encrypt secret
→ encode encrypted bytes as text-safe data
→ embed using variation selectorsThe hidden data may be lost if the text passes through systems that modify or sanitize Unicode.
Potential risks include:
- Unicode normalization
- Copy/paste cleaning
- Markdown sanitization
- HTML sanitization
- Plain-text export
- Database collation or filtering
- Messaging apps that strip unknown code points
- Search indexing systems
- Text editors that remove invisible characters
The CRC32 check helps detect corruption, but it does not prevent corruption.
This approach has several useful properties:
- The visible text remains mostly unchanged.
- The algorithm has deterministic encoding and decoding.
- The payload includes a recognizable magic header.
- The version byte allows future format changes.
- The payload length makes extraction precise.
- CRC32 allows accidental corruption to be detected.
- The scheme can represent arbitrary UTF-8 text.
The main limitations are:
- The hidden message is not encrypted.
- The carrier text must be long enough.
- Unicode variation selectors may be stripped by some systems.
- Some fonts, renderers, or platforms may display unexpected behavior.
- The presence of variation selectors can be detected programmatically.
- CRC32 is not a security mechanism.
- The payload size is limited to 65,535 bytes.
The Unicode Variation Selector steganographic text encoder hides a structured byte payload inside visible text by appending invisible Unicode variation selectors after visible characters.
Each hidden byte is mapped to one variation selector. The payload is wrapped in a block containing a magic identifier, version number, payload length, and CRC32 checksum. The decoder extracts variation selectors, converts them back into bytes, searches for the magic header, validates the checksum, and returns the decoded UTF-8 message.
The result is a simple and effective text steganography method suitable for hiding metadata or identifiers in Unicode text, provided the text is not passed through systems that strip or normalize variation selectors.