emoji_transcoder library

A Dart package for encoding and decoding arbitrary data into emojis using Unicode variation selectors.

This library allows you to hide text messages within any Unicode character (including emojis) by appending invisible variation selector codepoints. The hidden data is preserved during copy/paste operations but remains invisible to users.

⚠️ WARNING: This technique abuses the Unicode specification and should not be used in production systems. It can bypass visual content filters and has potential for malicious use.

Basic Usage

import 'package:emoji_transcoder/emoji_transcoder.dart';

// Encode a message
final encoded = EmojiTranscoder.encode('😊', 'Hello, World!');
print(encoded); // Looks like just '😊' but contains hidden data

// Decode the message
final decoded = EmojiTranscoder.decode(encoded);
print(decoded); // 'Hello, World!'

Multi-block Decoding

final text = EmojiTranscoder.encode('😊', 'hello') + 
             EmojiTranscoder.encode('🌟', 'world');

final messages = EmojiTranscoder.decodeAll(text);
// Returns [DecodedMessage('😊', 'hello'), DecodedMessage('🌟', 'world')]

Classes

DecodedMessage
Represents a decoded message with its associated base character.
EmojiTranscoder
Main class providing an API for emoji transcoding operations.

Functions

byteToVariationSelector(int byte) String
Converts a byte value (0-255) to its corresponding variation selector character.
containsEncodedData(String text) bool
Checks if text contains any encoded data.
decode(String encodedText) String
Decodes the first hidden message from encoded text.
decodeAll(String encodedText) List<DecodedMessage>
Decodes all hidden messages from encoded text.
encode(String baseCharacter, String message) String
Encodes a message into a base character using Unicode variation selectors.
encodeMultiple(Map<String, String> messages) String
Encodes multiple messages into a single text string.
encodeWithDefault(String message, {String? baseCharacter}) String
Encodes a message with automatic base character selection.
getCodepoint(String char) int
Gets the Unicode codepoint for a character.
getEncodedTextStats(String encodedText) Map<String, int>
Gets statistics about encoded text.
getVisibleText(String encodedText) String
Extracts just the base characters from encoded text.
getVisualLength(String encodedText) int
Estimates the visual length of encoded text.
hasEncodedData(String text) bool
Checks if a string contains encoded data (has variation selectors).
isVariationSelector(int codepoint) bool
Checks if a codepoint is a valid variation selector.
variationSelectorToByte(int codepoint) int?
Converts a variation selector codepoint back to its corresponding byte value.

Exceptions / Errors

DecodingException
Exception thrown when decoding fails.
EncodingException
Exception thrown when encoding fails.
InvalidByteException
Exception thrown when byte value is out of valid range (0-255).
InvalidVariationSelectorException
Exception thrown when codepoint is not a valid variation selector.