Tistory Base64 Obfuscation: A Beginner's Guide to Content Protection
Base64 is an encoding method originally created for data transfer reliability, but it can also be used to convert text or code into a format that is difficult for humans to read. Used correctly, it allows regular visitors to view content without issues while creating a barrier against simple copying or theft. By integrating Base64 encoding and decoding functions into the body of your Tistory blog posts, you can maintain your content's display while deterring unauthorized use.
In this article, we'll explore everything from the concept of Base64, the encoding method, its purpose, and how to apply an automatic decoding script to your Tistory blog.
1. What is Base64?
Base64 is an encoding method that converts binary data into a string. In simple terms, it's a technology that converts data like text or images into a human-readable combination of letters and numbers. The name "Base64" signifies that the conversion uses a character set of 64 characters.
AZ, az, 09, +, /
- Padding character: =
Base64 was created to safely exchange binary data in text-based transmission media like HTML, CSS, JSON, and email.
2. Base64 Encoding Method
The operational principle of Base64 is simple.
- Convert the original data into a binary format.
- Split the binary data into 6-bit chunks.
- Map each 6-bit value to a number in the range of 0 to 63.
- Convert the mapped number to its corresponding character from the Base64 character set.
- If the data doesn't divide perfectly into 6-bit chunks, the = symbol is added for padding.
Example:
Original: "한글" (Hangul)
UTF-8 binary conversion
Split into 6-bit chunks
Map to Base64 characters
Result: 7ZWc6riA
3. Purpose of Using Base64
The most common use of Base64 is for data transfer reliability.
- Transferring binary data in a text environment
- Example: Email attachments, images within JSON data
- Safely embedding data in URLs
- Can be included safely without special characters or line breaks.
- Content obfuscation
- Makes code or text difficult for the average person to read, preventing unauthorized use.
- Simple data hiding
- While it should never be used for password encryption, it's useful for lightly obscuring non-sensitive data.
Note: Base64 is "encoding," not "encryption." This means it is not highly secure and is not suitable for protecting sensitive information.
Content Obfuscation Decoding Program
Content Obfuscation Method to Prevent Unauthorized Use
Korean Base64 Encoding
Base64 → Original Text Decoding Tool
Base64 Decoding (Korean Supported)
Automatically Decoding Base64 Content in Tistory Blog Posts
This code automatically decodes Base64-encoded text, converting it into human-readable HTML. It is specifically designed to work only within the Tistory blog post body, minimizing conflicts with other areas like the menu, sidebar, or other scripts.
Core Functions Summary
| Function | Description |
| isBase64() | Checks if a string is in Base64 format. |
| decodeBase64ToHTML() | Converts a Base64 string to HTML. |
| decodeTextNodes() | Iterates through all text nodes and converts any Base64 it finds. |
| Post Body Restriction | Only runs in the .tt_article_useless_p_margin.contents_style class area. |
How to Apply to a Tistory Blog
Application Steps
- Access your Tistory Admin Page.
- Go to Skin Edit > HTML Edit.
- Paste the code below just before the closing body tag (</body>).
(function() {
// 1. Check if a string is Base64
function isBase64(str) {
if (!str) return false;
str = str.replace(/\s+/g, '');
return /^[A-Za-z0-9+/]{8,}={0,2}$/.test(str);
}
// 2. Convert Base64 to HTML
function decodeBase64ToHTML(b64) {
try {
const bin = atob(b64); // Base64 binary string
const bytes = Uint8Array.from(bin, c = c.charCodeAt(0)); // Binary byte array
return new TextDecoder('utf-8').decode(bytes); // Byte array to UTF-8 string
} catch (e) {
return b64; // Return original if decoding fails
}
}
// 3. Find and decode all text nodes within the post body
function decodeTextNodes(node) {
node.childNodes.forEach(child = {
if (child.nodeType === Node.TEXT_NODE) {
const trimmed = child.textContent.trim();
if (isBase64(trimmed)) {
const span = document.createElement('span');
span.innerHTML = decodeBase64ToHTML(trimmed);
child.replaceWith(...span.childNodes);
}
} else if (child.nodeType === Node.ELEMENT_NODE) {
const tag = child.tagName.toLowerCase();
// Protect iframes, figures, scripts, image placeholders, index-checker-container
if (
tag !== 'iframe' &&
tag !== 'figure' &&
tag !== 'script' &&
!child.textContent.includes('[##_Image|') &&
child.id !== 'index-checker-container'
) {
decodeTextNodes(child); // Recursive search
}
}
});
}
// 4. Execute only in the Tistory post body area
const articleDiv = document.querySelector('.tt_article_useless_p_margin.contents_style');
if (articleDiv) {
decodeTextNodes(articleDiv);
}
})();
Usage Precautions
- Not a Security Feature
This script is for de-obfuscation only and is not a form of encryption for security enhancement. - Prevents Changes to Non-Body Areas
The code already excludes iframes, scripts, image placeholders, etc., from the decoding process. - Compatibility
It should work on most modern browsers, but may not function on very old browsers (IE 10 or below).
What is Base64 and why is it used on blogs?
Base64 is an encoding method that converts text or images into a string that is difficult for humans to read. On a Tistory blog, it can be used to obfuscate parts of the content to prevent unauthorized copying or crawling, while still allowing regular visitors to view the post without issues.
How can I automatically decode Base64 content on my Tistory blog?
You can do this by inserting a JavaScript snippet that is applied only to the post body. This script checks for the Base64 format, searches text nodes, and converts them to HTML. To apply it, go to Skin Edit > HTML Edit and paste the code just above the </body> tag.
What should I be aware of when using Base64 obfuscation?
Base64 is not encryption, so it's not suitable for protecting sensitive information. Additionally, areas outside the post body should be excluded from decoding, and it may not be compatible with older browsers. The primary purpose of this obfuscation is to prevent unauthorized copying.
Social Plugin