Audio Steganography Gaming Project in C++

Explanation

  1. Include Libraries:
    • #include <iostream>: For input and output operations.
    • #include <fstream>: For file handling.
    • #include <vector>: For using vectors to manage data.
    • #include <cstring>: For C-string manipulation functions (though not used in this example).
  2. Embed Message Function (embedMessage):
    • Opens the input WAV file for reading and the output WAV file for writing.
    • Reads the WAV header and writes it to the output file.
    • Prepares the message to embed by null-terminating it and converting it into a bit vector.
    • Reads the audio data from the WAV file into a vector.
    • Embeds the message into the least significant bits (LSBs) of the audio data.
    • Writes the modified audio data to the output file.
  3. Extract Message Function (extractMessage):
    • Opens the WAV file and skips the header.
    • Reads the audio data into a vector.
    • Extracts the message from the LSBs of the audio data.
    • Converts the extracted bits back into a string.
  4. Main Function (main):
    • Defines file names and a message.
    • Calls embedMessage to embed the message into the audio file.
    • Calls extractMessage to extract and print the message from the modified audio file.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top