This website is protected and accelerated by IONOS, Vercel and Cloudflare. They may set cookies that are essential for security and performance, such as preventing malicious attacks and ensuring reliable content delivery. These cookies do NOT track personal data and are necessary for the website to function correctly.

Start Encoding

No file Selected

Must be at least 12 characters

And include at least 2 numbers

And include a symbol

A private passkey will be generated with your newly encoded image.

Start Decoding

No file Selected
No file Selected

Decoded data will appear here!

Coding Steganography

Psudocoding Algorithms for Encoding & Decoding

Psudocode

I have listed the psudocode for the encoding and encoding algorithms. The goal is for you to learn as you code so I have been deliberately vague. I have not included how to code the call functions and would like you guys to attempt to figure this out. However, any issues, questions or hints, then don't hesitate to get in touch!

Encoding Algorithms

function ENCODE_PASSWORD (image,text,pw):

  • USED_PIXELS = [];
  • SALT = generateSalt();
  • SECRETKEY = getKeyFromPassword(pw,SALT);
  • STRING_BYTES = compressString(text);
  • ENCRYPTED_BYTES = byteEncyption(STRING_BYTES,SECRETKEY);
  • PAYLOAD = [];
  • PAYLOAD_DATA = [PAYLOAD];
  • BUFFER = [PAYLOAD_DATA];
  • BINARY = bytesToBinary(BUFFER);
  • SEED = generateSeed(pw);
  • RANDOM(SEED);
  • STRING_INDEX = 0;

  • for STRING_INDEX to BINARY.length:
    • x = RANDOM, y = RANDOM;
    • PAYLOAD.append(SALT);
    • PAYLOAD.append(ENCRYPTED_BYTES);

    • if not contain USED_PIXELS(x,y):
      1. USED_PIXELS.append(x,y);
      2. pixel = image.getRGB(x,y);
      3. red = EXTRACT THE BITWISE(pixel, 16)
      4. green = EXTRACT THE BITWISE(pixel, 8)
      5. blue = EXTRACT THE BITWISE(pixel)
      6. while STRING_INDEX less than BINARY.length:
        • setLeastSignificantBit(red, STRING_INDEX++);
        • setLeastSignificantBit(green, STRING_INDEX++);
        • setLeastSignificantBit(blue, STRING_INDEX++);
      7. newPixel = (red,green,blue)
      8. image = (x,y,newPixel)

RETURN image;

function ENCODE_PASSKEY (image,text,publicKey,privateKey):

  • USED_PIXELS = [];
  • AES_KEY = generateAESKey();
  • SECRETKEY = getAESKeyFromBytes(AES_KEY);
  • IV = bytes [16]
  • COMPRESS_STRING = compressString(text);
  • ENCRYPTED_DATA = encryptionAES(COMPRESS_STRING,SECRETKEY,IV);
  • ENCRYPTED_RSA = getAESKeyWithRSA(AES_KEY,publicKey);
  • PAYLOAD = [];
  • PAYLOAD_DATA = [PAYLOAD];
  • BUFFER = [PAYLOAD_DATA];
  • BINARY = bytesToBinary(BUFFER);
  • SEED = generateSeed(privateKey);
  • RANDOM(SEED);
  • STRING_INDEX = 0;

  • PAYLOAD.append(ENCRYPTED_RSA);
  • PAYLOAD.append(IV);
  • PAYLOAD.append(ENCRYPTED_DATA);

  • for STRING_INDEX to BINARY.length:
      • x = RANDOM, y = RANDOM;
      • if not contain USED_PIXELS(x,y):
        1. USED_PIXELS.append(x,y);
        2. pixel = image.getRGB(x,y);
        3. red = EXTRACT THE BITWISE(pixel, 16)
        4. green = EXTRACT THE BITWISE(pixel, 8)
        5. blue = EXTRACT THE BITWISE(pixel)
        6. while STRING_INDEX less than BINARY.length:
          • setLeastSignificantBit(red, STRING_INDEX++);
          • setLeastSignificantBit(green, STRING_INDEX++);
          • setLeastSignificantBit(blue, STRING_INDEX++);
        7. newPixel = (red,green,blue)
        8. image = (x,y,newPixel)

RETURN image;

Decoding Algorithms

function DECODE_PASSWORD (image,pw):

  • USED_PIXELS = [];
  • ENCRYPTED_BINARY = STRING;
  • ENCRYPTED_TEXT = STRING;
  • SEED = generateSeed(pw)
  • RANDOM = (SEED);
  • START = key_word;
  • END = key_word;
  • DECOMPRESS_STR = STRING

  • while ENCRYPTED_TEXT does not contain END:
      • x = RANDOM, y = RANDOM;
      • if not contain USED_PIXELS(x,y):
        1. USED_PIXES(x,y);
        2. pixel = image.getRGB(x,y);
        3. red = EXTRACT THE BITWISE(pixel, 16)
        4. green = EXTRACT THE BITWISE(pixel, 8)
        5. blue = EXTRACT THE BITWISE(pixel)
        6. ENCRYPTED_BINARY.append(red)
        7. ENCRYPTED_BINARY.append(green)
        8. ENCRYPTED_BINARY.append(blue)
        9. if ENCRYPTED_BINARY.length equal to or above 8:
          • EIGHT_BITS = ENCRYPTED_BINARY.substring(0,8)
          • ENCRYPTED_TEXT += EIGHT_BITS
          • ENCRYPTED_BINARY.remove(0,8)
          • if ENCRYPTED_TEXT.endsWith(END) break;
        10. if ENCRYPTED_TEXT start with START and ends with END:
            • startIndex = INTEGER(START)
            • endIndex = INTEGER(END)

            • BINARY = textToBinary(ENCRYPTED_TEXT)
            • BYTES = binaryToBytes(BINARY)
            • PAYLOAD_LENGTH = BYTES.length
            • PAYLOAD = [BYTES + PAYLOAD_LENGTH]

            • INPUT_STREAM = PAYLOAD
            • SALT = input.readBytes()
            • ENCRYPTED_DATA = input.readBytes()
            • SECRET_KEY = getKeyFromPasswor(pw,salt)
            • DECRYPTED_BYTES = byteDecryption(ENCRYPTED_DATA, SECRET_KEY)
            • DECOMPRESS_STR = decompressBytes(DECRYPTED_BYTES)
            • if DECOMPRESS_STR equals null RETURN "Decoding Failed";

RETURN DECOMPRESS_STR;

function DECODE_PASSKEY (image,privateKey):

  • USED_PIXELS = [];
  • ENCRYPTED_BINARY = STRING;
  • ENCRYPTED_TEXT = STRING;
  • SEED = generateSeed(privateKey)
  • RANDOM = (SEED);
  • START = key_word;
  • END = key_word;
  • DECOMPRESS_STR = STRING

  • while does not contain END:

    • x = RANDOM, y = RANDOM;
    • if not contain USED_PIXELS(x,y):
      1. USED_PIXELS(x,y);
      2. pixel = image.getRGB(x,y);
      3. red = EXTRACT THE BITWISE(pixel, 16)
      4. green = EXTRACT THE BITWISE(pixel, 8)
      5. blue = EXTRACT THE BITWISE(pixel)
      6. ENCRYPTED_BINARY.append(red)
      7. ENCRYPTED_BINARY.append(green)
      8. ENCRYPTED_BINARY.append(blue)

      9. if ENCRYPTED_BINARY.length equal to or above 8:
        • EIGHT_BITS = ENCRYPTED_BINARY.substring(0,8)
        • ENCRYPTED_TEXT += EIGHT_BITS
        • ENCRYPTED_BINARY.remove(0,8)
        • if ENCRYPTED_TEXT.endsWith(END) break;
      10. if ENCRYPTED_TEXT start with START and ends with END:
        • startIndex = INTEGER(START)
        • endIndex = INTEGER(END)

        • BINARY = textToBinary(ENCRYPTED_TEXT)
        • BYTES = binaryToBytes(BINARY)
        • PAYLOAD_LENGTH = BYTES.length
        • PAYLOAD = [BYTES + PAYLOAD_LENGTH]

        • INPUT_STREAM = PAYLOAD
        • RSA_KEY = input.readBytes()
        • IV = input.readBytes()
        • ENCRYPTED_DATA = input.readBytes()

        • AES_BYTES = decryptAESKEYFromRSA(RSA_KEY, privateKey)
        • SECRET_KEY = getAESFromBytes(AES_BYTES)
        • DECRYPTED_BYTES = decryptAES(ENCRYPTED_DATA, SECRET_KEY, IV)
        • DECOMPRESS_STR = decompressBytes(DECRYPTED_BYTES)
        • if DECOMPRESS_STR equals null RETURN "Decoding Failed";

RETURN DECOMPRESS_STR;