Tool for encrypting and decrypting messages with Twin Hex encryption, an encryption algorithm based on pairs of letters encoded in base 36.
Twin Hex Cipher - dCode
Tag(s) : Substitution Cipher
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
The Twin Hex encryption process only works on printable ASCII characters (codes 32 to 127).
Example: Encrypt the dCode message
Each pair of characters (bigram) is then indexed according to its rank among possible bigrams (the first bigram with codes 32,32 has the value $0$, then 32,33 has the index $1$, up to '127,127 ' which has a value of $9216). If the message is odd in length, complete with a space.
Example: dC has index $ 6563 $, od has index $ 7652 $ and e (a space has been added) has index $ 6624 $.
The index is then converted to base36 (symbols 0123456789abcdefghijklmnopqrstuvwxyz) optionally supplemented by spaces (on the right) to obtain a trigram.
Example: $ 6563_{(10)} = \texttt{52b}_{(36)} $ (see the page dedicated to base n conversion)
The concatenation of the trigrams obtained forms the encrypted message.
Example: dCode is encrypted in Twin Hex as 52b5wk540
To decipher Twin Hex ciphertext, the decryption process begins by breaking the text into trigrams.
Example: Decrypt the message 3x35gu14 56g
Each trigram is then considered as a base36 number whose decimal value corresponds to an index among the possible ASCII bigrams.
Example: $ \texttt{3x3}_{(36)} = 5079_{(10)} $ and $ 5079 $ corresponds to the bigram Tw
$ \texttt{5gu}_{(36)} = 7086_{(10)} $ and $ 7086 $ matches the bigram in, etc.
The plain message consists of the concatenation of the bigrams obtained.
Example: The original message is 'Twin Hex'
Twin Hex is made up of lowercase alphanumeric characters a-z0-9 (default).
The indication twin or jumeau is a clue.
Mike Brockington's site here seems to be the original source but the form does not work correctly, use with caution.
dCode retains ownership of the "Twin Hex Cipher" source code. Any algorithm for the "Twin Hex Cipher" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Twin Hex Cipher" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Twin Hex Cipher" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Twin Hex Cipher" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Twin Hex Cipher on dCode.fr [online website], retrieved on 2025-04-16,