Internet-Draft XB64 Reversible Obfuscation November 2026
Harano Expires 19 May 2027 [Page]
Workgroup:
Network Working Group
Internet-Draft:
draft-harano-xb64-00
:
Published:
Intended Status:
Informational
Expires:
Author:
T. Harano

XB64: A Lightweight Reversible Obfuscation Encoding

Abstract

This document specifies XB64 (XORed Base64), a lightweight reversible obfuscation encoding scheme for situations where immediate readability of source data is undesirable but cryptographic confidentiality is not required.

To provide a key-dependent yet fully reversible representation, XB64 applies repeating-key XOR to arbitrary octet sequences and encodes the result as printable ASCII text using Base64 as specified in RFC 4648. The resulting text itself preserves the source information, allowing exact reconstruction with the same key without external data lookup, while remaining suitable for human handling and exchange through text-oriented systems.

By specifying a common encoding format for this level of obfuscation, this document aims to enable interoperable use across different applications, platforms, and implementations.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 19 May 2027.

▲

Table of Contents

1. Introduction

Some applications need to avoid immediately exposing source data without requiring cryptographic confidentiality. XB64 provides a lightweight, reversible obfuscation mechanism for this purpose.

XB64 applies repeating-key XOR to arbitrary source octets and represents the result as printable ASCII text using Base64 as specified in Sections 3 and 4 of [RFC4648].

2. Conventions

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

3. Encoding Algorithm

3.1. Input

The encoding operation accepts:

  • A source octet sequence S of length n.

  • A key octet sequence K of length m.

3.2. XOR Transformation

Each source octet is XORed with the corresponding key octet. The key is applied cyclically as necessary.

For each source index i, where 0 <= i < n, and m > 0:

T[i] = S[i] XOR K[i mod m]

where:

S[i] = source octet at index i
K[j] = key octet at index j (0 <= j < m)
T[i] = transformed octet at index i
n    = source length
m    = key length

3.3. Output

The transformed octet sequence T is encoded using Base64.

The resulting ASCII text, denoted E, is the XB64-encoded output.

4. Decoding Algorithm

4.1. Input

The decoding operation accepts:

  • XB64-encoded ASCII text E.

  • A key octet sequence K.

Using the same key octets as those supplied during encoding guarantees reconstruction of the original source.

When a key is supplied as text, the conversion rules of Section 6 apply.

4.2. Base64 Decoding

The encoded text is decoded using Base64 to obtain the transformed octet sequence T.

Decoders MAY accept non-conforming Base64 input. The handling of such input is implementation-defined.

4.3. Reverse XOR Transformation

The decoder applies the XOR transformation defined in Section 3.2 to the decoded octet sequence T using the supplied key K.

Because XOR is self-inverse, this operation reconstructs the original source octet sequence S.

4.4. Decoding Result

The complete decoding process can be expressed as:

XB64_Decode(E, K) = XOR_Transform(Base64_Decode(E), K)

For any source S and key K:

XB64_Decode(XB64_Encode(S, K), K) = S

The equality holds for arbitrary source octet sequences, including empty sequences and non-textual binary data.

5. Boundary Conditions

5.1. Empty Source

If the source S is empty, encoding produces an empty string regardless of the key K.

5.2. Empty Key

If the key K is empty, the XOR transformation is bypassed during both encoding and decoding. The encoded result is the ordinary Base64 representation of S.

5.3. Key Longer Than Source

If the key is longer than the source, the unused portion has no effect on the result.

For a source of n octets, keys of length at least n that share the same first n octets produce identical encoded results, regardless of their remaining octets.

6. Key Representation

The XB64 transformation uses an octet sequence as its key.

Textual keys are recommended for ease of handling and exchange. ASCII-only textual keys are preferred for interoperability and SHOULD be represented by their corresponding ASCII octet values.

For textual keys containing non-ASCII characters, UTF-8 [RFC3629] SHOULD be used to convert the text to octets. Other character encodings MAY be used.

Keys MAY also be supplied directly as arbitrary octet sequences.

7. Test Vectors

This section provides test vectors for independent implementations.

Unless otherwise indicated, source and key values are represented as hexadecimal octets.

The ASCII text descriptions are illustrative. The XB64 transformation treats source data as an octet sequence without interpreting it as text, regardless of whether the source data is textual or binary.

The following examples can be used to verify both encoding and decoding using the specified keys.

7.1. Basic Encoding

ASCII text "abc" using the key "xyz":

Source:  61 62 63
Key:     78 79 7A
XOR:     19 1B 19
Encoded: GRsZ

7.2. Repeating Key

ASCII text "abcde" using the key "xyz":

Source:  61 62 63 64 65
Key:     78 79 7A
XOR:     19 1B 19 1C 1C
Encoded: GRsZHBw=

7.3. Key Longer Than Source

ASCII text "ab" using the key "xyz":

Source:  61 62
Key:     78 79 7A
XOR:     19 1B
Encoded: GRs=

7.4. Empty Source

An empty source using the key "xyz":

Source:  (empty)
Key:     78 79 7A
Encoded: (empty)

7.5. Empty Key

ASCII text "abc" using an empty key (equivalent to standard Base64 encoding):

Source:  61 62 63
Key:     (empty)
Encoded: YWJj

8. Security Considerations

8.1. Obfuscation, Not Encryption

XB64 is a reversible obfuscation encoding scheme intended to reduce the immediate readability of source data. It is not an encryption mechanism and does not provide confidentiality.

XB64-encoded data MUST NOT be treated as encrypted or used as a substitute for cryptographic protection when confidentiality of the source data is required.

8.2. Key Handling and Disclosure

The XB64 key is not a cryptographic key, but a parameter used for the reversible XOR transformation.

The key may be kept separate from the encoded data to increase the effort required for recovery, or disclosed alongside it when immediate readability is undesirable but convenient recovery is preferred. Keeping the key undisclosed does not guarantee confidentiality.

8.3. Inherent Limitations of Repeating-Key XOR

When a source octet and its corresponding transformed octet are known, the applied key octet can be recovered through XOR. Because the key is repeated cyclically, recovered key octets can also be used to recover source octets at other positions.

When source octets are zero, the corresponding transformed octets directly reveal the applied key octets. Conversely, when applied key octets are zero, the corresponding source octets remain unchanged in the transformed data.

9. IANA Considerations

This document does not require any IANA actions.

10. Normative References

[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
[RFC3629]
Yergeau, F., "UTF-8, a transformation format of ISO 10646", RFC 3629, DOI 10.17487/RFC3629, , <https://www.rfc-editor.org/info/rfc3629>.
[RFC4648]
Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, DOI 10.17487/RFC4648, , <https://www.rfc-editor.org/info/rfc4648>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/info/rfc8174>.

Author's Address

Takashi Harano