Srdjan Janjin


Use this simple tool to encrypt and decrypt a short binary message. 'Crypto Algorithm Yin Yang' is a simple encryption algorithm example.

Test your cryptanalysis skills. Analyse it.

Try to break the code.

Enter the binary message in the upper box and receive the encrypted text - random numbers will appear in the box below.

The length of the encrypted text is not fixed.

The maximum number of characters in the encrypted text is limited to 1000; if the result is longer, it is truncated.

Enter encrypted text in the box below and tap on 'decrypt' to get the original binary message.

The message is encrypted with random numbers, so it can be combined with one of the steganography tools to hide the encrypted message as noise in an image, for example.

Download the tool from Google Play.

The app interface is rather simple:



Type a binary number in the box above and tap on Encrypt. You can copy the result and send it to someone who can decrypt it by pasting it into the box below and tapping on  'Decrypt'.

Algorithm Specification: Yin Yang Cipher

1. Overview

The Yin Yang Cipher is a custom steganographic algorithm designed to encode binary data into a stream of seemingly random digits (0–9). The cipher uses a secret cyclic digit key (C) and parity-based logic to transform each bit into a variable-length digit sequence.


2. Components

  • C: Secret cyclic key — a list of digits C = [c₀, c₁, ..., cₖ] where each cᵢ ∈ {0,1,...,9}.

  • M: Binary message (sequence of bits) M = [b₀, b₁, ..., bₙ], with each bᵢ ∈ {0,1}.

  • E: Ciphered output — a sequence of digits E = [e₀, e₁, ..., eₘ].


3. Initialization

  1. Define the cyclic cipher key C. It must be shared or stored securely.

  2. Initialize an empty output list E.

  3. Set pointer i = 0 to track the current bit in the message M.

  4. Set cipher pointer k = 0 to track position in the cyclic key C.


4. Start Marker

To mark the beginning of the encoded message:

  • Random digits are generated and appended to E until the first match with C[0] is found.

  • The matched digit (C[0]) is added to and becomes the start flag.


5. Encoding Loop

For each bit bᵢ in a binary message M:

  1. Let current_cipher = C[k], where k is the index in the cyclic cipher (k = i mod len(C)).

  2. Generate a random digit stream R = [r₁, r₂, ..., rₜ] under the following rules:

    • If bᵢ = 0: generate digits until an odd number is encountered.

      • The odd number becomes the first digit r₁.

      • The remaining generated digits are appended in order r₂, r₃, ..., rₜ.

    • If bᵢ = 1: generate digits until an even number is encountered.

      • The even number becomes the first digit r₁.

      • The remaining generated digits follow.

  3. Add sequence R to output E.

  4. Increment i and k.


6. Final Output

  • E is the resulting list of digits representing the ciphered (steganographically encoded) binary message.

  • All digits appear to be random and conform to the digit space {0–9}.


7. Decoding Algorithm

Given E and key C:

  1. Scan E until the first digit matching C[0] is found — this is the start marker.

  2. From the digit after the start marker, decode in steps:

    • For each cipher digit C[k] (cycled), read the next segment of digits:

      • The first digit of the segment determines the bit:

        • If it's odd → decoded bit is 0

        • If it's even → decoded bit is 1

      • Skip the rest of the digits in that segment (until the next valid leading digit is found)

  3. Repeat until all bits are decoded.


8. Security Notes

  • Obfuscation, not encryption: This is a steganographic algorithm and does not provide strong cryptographic guarantees.

  • The random stream must use a secure PRNG if secrecy is desired.

  • The key C must be kept secret to prevent easy decoding.

9. Potential Enhancements

  • Integrate a keyed PRNG seeded by C or a passphrase.

  • Add optional message length encoding.

  • Encrypt the binary message with a real cipher (e.g., XOR, AES) before applying Yin Yang encoding.

 Notes:

  • cipher: list of digits like [3, 6, 1] — acts as the secret cyclic key.

  • The binary message is a string like "10101".

  • Random output will differ each time due to noise.