|
| 1 | +--- |
| 2 | +title: Emoji Nachricht Kodierer |
| 3 | +description: Verstecke deine Nachricht in Emojis! |
| 4 | +date: 2025-03-06T10:00:00.000Z |
| 5 | +tags: |
| 6 | + - emoji |
| 7 | + - coding |
| 8 | + - verschlüsselung |
| 9 | +categories: |
| 10 | + - tools |
| 11 | + - web |
| 12 | +--- |
| 13 | + |
| 14 | +<div class="emoji-container"> |
| 15 | + <h1>Verstecke Nachrichten in Emojis</h1> |
| 16 | + |
| 17 | + <label for="encodeInput">Gib deine Nachricht ein:</label> |
| 18 | + <textarea id="encodeInput" placeholder="Gib hier deine Nachricht ein"></textarea> |
| 19 | + |
| 20 | + <div class="emoji-picker"> |
| 21 | + <span onclick="setEmoji('😀')">😀</span> |
| 22 | + <span onclick="setEmoji('😎')">😎</span> |
| 23 | + <span onclick="setEmoji('😍')">😍</span> |
| 24 | + <span onclick="setEmoji('👍')">👍</span> |
| 25 | + <span onclick="setEmoji('💥')">💥</span> |
| 26 | + <span onclick="setEmoji('🎉')">🎉</span> |
| 27 | + <span onclick="setEmoji('💬')">💬</span> |
| 28 | + <span onclick="setEmoji('🌟')">🌟</span> |
| 29 | + </div> |
| 30 | + |
| 31 | + <button onclick="encodeMessage()">Kodieren</button> |
| 32 | + |
| 33 | + <h2>Versteckte Emoji-Nachricht:</h2> |
| 34 | + <p id="encodedMessage" class="encoded-output"></p> |
| 35 | + |
| 36 | + <label for="decodeInput">Füge deine Emoji-Nachricht hier ein:</label> |
| 37 | + <textarea id="decodeInput" placeholder="Füge hier deine versteckte Emoji-Nachricht ein"></textarea> |
| 38 | + <button onclick="decodeMessage()">Dekodieren</button> |
| 39 | + |
| 40 | + <h2>Dekodierte Nachricht:</h2> |
| 41 | + <p id="decodedMessage" class="decoded-output"></p> |
| 42 | +</div> |
| 43 | + |
| 44 | +<script> |
| 45 | + const VARIATION_SELECTOR_START = 0xfe00; |
| 46 | + const VARIATION_SELECTOR_END = 0xfe0f; |
| 47 | + const VARIATION_SELECTOR_SUPPLEMENT_START = 0xe0100; |
| 48 | + const VARIATION_SELECTOR_SUPPLEMENT_END = 0xe01ef; |
| 49 | + |
| 50 | + function toVariationSelector(byte) { |
| 51 | + if (byte >= 0 && byte < 16) { |
| 52 | + return String.fromCodePoint(VARIATION_SELECTOR_START + byte); |
| 53 | + } else if (byte >= 16 && byte < 256) { |
| 54 | + return String.fromCodePoint(VARIATION_SELECTOR_SUPPLEMENT_START + byte - 16); |
| 55 | + } else { |
| 56 | + return null; |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + function fromVariationSelector(codePoint) { |
| 61 | + if (codePoint >= VARIATION_SELECTOR_START && codePoint <= VARIATION_SELECTOR_END) { |
| 62 | + return codePoint - VARIATION_SELECTOR_START; |
| 63 | + } else if (codePoint >= VARIATION_SELECTOR_SUPPLEMENT_START && codePoint <= VARIATION_SELECTOR_SUPPLEMENT_END) { |
| 64 | + return codePoint - VARIATION_SELECTOR_SUPPLEMENT_START + 16; |
| 65 | + } else { |
| 66 | + return null; |
| 67 | + } |
| 68 | + } |
| 69 | + |
| 70 | + function encode(emoji, text) { |
| 71 | + const bytes = new TextEncoder().encode(text); |
| 72 | + let encoded = emoji; |
| 73 | + |
| 74 | + for (const byte of bytes) { |
| 75 | + encoded += toVariationSelector(byte); |
| 76 | + } |
| 77 | + |
| 78 | + return encoded; |
| 79 | + } |
| 80 | + |
| 81 | + function decode(text) { |
| 82 | + let decoded = []; |
| 83 | + const chars = Array.from(text); |
| 84 | + |
| 85 | + for (const char of chars) { |
| 86 | + const byte = fromVariationSelector(char.codePointAt(0)); |
| 87 | + |
| 88 | + if (byte === null && decoded.length > 0) { |
| 89 | + break; |
| 90 | + } else if (byte === null) { |
| 91 | + continue; |
| 92 | + } |
| 93 | + |
| 94 | + decoded.push(byte); |
| 95 | + } |
| 96 | + |
| 97 | + let decodedArray = new Uint8Array(decoded); |
| 98 | + return new TextDecoder().decode(decodedArray); |
| 99 | + } |
| 100 | + |
| 101 | + function encodeMessage() { |
| 102 | + const inputMessage = document.getElementById("encodeInput").value; |
| 103 | + const selectedEmoji = window.selectedEmoji || '😀'; |
| 104 | + const encodedMessage = encode(selectedEmoji, inputMessage); |
| 105 | + document.getElementById("encodedMessage").textContent = encodedMessage; |
| 106 | + } |
| 107 | + |
| 108 | + function decodeMessage() { |
| 109 | + const inputMessage = document.getElementById("decodeInput").value; |
| 110 | + const decodedMessage = decode(inputMessage); |
| 111 | + document.getElementById("decodedMessage").textContent = decodedMessage; |
| 112 | + } |
| 113 | + |
| 114 | + function setEmoji(emoji) { |
| 115 | + window.selectedEmoji = emoji; |
| 116 | + } |
| 117 | +</script> |
| 118 | + |
| 119 | +<style> |
| 120 | + /* Styles nur für diesen Blog-Post */ |
| 121 | + .emoji-container { |
| 122 | + text-align: center; |
| 123 | + background: rgba(0, 0, 0, 0.6); |
| 124 | + padding: 30px; |
| 125 | + border-radius: 15px; |
| 126 | + box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3); |
| 127 | + width: 100%; |
| 128 | + max-width: 800px; |
| 129 | + margin: 0 auto; |
| 130 | + color: white; |
| 131 | + font-family: 'Roboto', sans-serif; |
| 132 | + } |
| 133 | + |
| 134 | + h1 { |
| 135 | + font-size: 2.5rem; |
| 136 | + margin-bottom: 20px; |
| 137 | + font-weight: 700; |
| 138 | + } |
| 139 | + |
| 140 | + h2 { |
| 141 | + font-size: 1.8rem; |
| 142 | + margin-top: 40px; |
| 143 | + } |
| 144 | + |
| 145 | + textarea { |
| 146 | + width: 100%; |
| 147 | + height: 120px; |
| 148 | + padding: 10px; |
| 149 | + margin-top: 10px; |
| 150 | + font-size: 1rem; |
| 151 | + border-radius: 10px; |
| 152 | + border: 2px solid #ddd; |
| 153 | + background: #222; |
| 154 | + color: #fff; |
| 155 | + resize: none; |
| 156 | + font-family: 'Roboto', sans-serif; |
| 157 | + } |
| 158 | + |
| 159 | + button { |
| 160 | + background-color: #4CAF50; |
| 161 | + color: white; |
| 162 | + border: none; |
| 163 | + padding: 10px 20px; |
| 164 | + font-size: 1rem; |
| 165 | + margin-top: 20px; |
| 166 | + border-radius: 5px; |
| 167 | + cursor: pointer; |
| 168 | + transition: background-color 0.3s ease; |
| 169 | + } |
| 170 | + |
| 171 | + button:hover { |
| 172 | + background-color: #45a049; |
| 173 | + } |
| 174 | + |
| 175 | + .emoji-picker { |
| 176 | + margin-top: 20px; |
| 177 | + font-size: 2rem; |
| 178 | + display: flex; |
| 179 | + justify-content: center; |
| 180 | + flex-wrap: wrap; |
| 181 | + gap: 10px; |
| 182 | + } |
| 183 | + |
| 184 | + .emoji-picker span { |
| 185 | + cursor: pointer; |
| 186 | + transition: transform 0.3s ease; |
| 187 | + } |
| 188 | + |
| 189 | + .emoji-picker span:hover { |
| 190 | + transform: scale(1.2); |
| 191 | + } |
| 192 | + |
| 193 | + .encoded-output { |
| 194 | + background: rgba(255, 255, 255, 0.1); |
| 195 | + padding: 15px; |
| 196 | + margin-top: 20px; |
| 197 | + font-size: 1.2rem; |
| 198 | + border-radius: 10px; |
| 199 | + word-wrap: break-word; |
| 200 | + } |
| 201 | + |
| 202 | + .decoded-output { |
| 203 | + background: rgba(255, 255, 255, 0.1); |
| 204 | + padding: 15px; |
| 205 | + margin-top: 20px; |
| 206 | + font-size: 1.2rem; |
| 207 | + border-radius: 10px; |
| 208 | + } |
| 209 | +</style> |
0 commit comments