coverFiles.append(os.path.join(r, file)) coverFiles = coverFiles[0:numSongsPerGenre] for t in coverFiles: for LSB_index in range(0, len(LSBs)): AESkeyEncode = "THIS_IS_THE_KEY_USED_FOR_AES_ENCRYPTION" samplesOne, samplesTwo, rate = fp.getWaveSamples(t) originalCoverSamples = deepcopy(samplesOne) if (audioOrText == True): message = "" message = fp.getMessageBits('C:/Users/Johan Gouws/Desktop/Audio-Steganograpy/src/Media/text.txt') message = list(map(str, message)) message = "".join(message) originalMessage = deepcopy(message) message = AES.encryptBinaryString(message, AESkeyEncode) message = list(map(int, list(message))) message = "".join(list(map(str, message))) else: # Get the audio samples in integer form intSamples = fp.extractWaveMessage('C:/Users/Johan Gouws/Desktop/Audio-Steganograpy/src/Media/ShortOpera.wav') rate,originalDecSamples=scWave.read('C:/Users/Johan Gouws/Desktop/Audio-Steganograpy/src/Media/ShortOpera.wav') # Convert to integer list of bits for embedding message = "".join(intSamples[0])
# Get the string representation of the key in ASCII keyString = 'GA_KEY' AESkeyEncode = 'AES_key' coverSamplesOne, coverSamplesTwo, rate = fp.getWaveSamples( 'Media/opera.wav') for i in range(0, len(coverSamplesOne)): if (coverSamplesOne[i] <= -32768): coverSamplesOne[i] += 1 coverSamples = [coverSamplesOne, coverSamplesTwo] secretMessage = "" secretMessage = fp.getMessageBits('Media/text.txt') secretMessage = list(map(str, secretMessage)) secretMessage = ''.join(secretMessage) #secretMessage = AES.encryptBinaryString(secretMessage, AESkeyEncode) secretMessage = list(map(int, list(secretMessage))) # Convert ASCII to binary binaryKey = fp.messageToBinary(keyString) binaryKey = binaryKey * int( (len(secretMessage) + float(len(secretMessage)) / len(binaryKey))) stegoSamples = GA_encoding(coverSamples, secretMessage, binaryKey, rate, '.txt') originalStegoSamples = deepcopy(stegoSamples)
'C:/Users/Johan Gouws/Desktop/Survey/A_Jazz_Akbar_Muhammad_Quartet-Ebony_Beauty.wav', 'C:/Users/Johan Gouws/Desktop/Survey/A_Pop_Arthur_Yoria-P_S_A_.wav', 'C:/Users/Johan Gouws/Desktop/Survey/A_Rock_April_Sixth-Bring_Me_Down.wav'] audioOrText = True for t in range(0,len(coverFiles)): for OBH_index in range(0, len(OBHs)): AESkeyEncode = "THIS_IS_THE_KEY_USED_FOR_AES_ENCRYPTION" samplesOne, samplesTwo, rate = fp.getWaveSamples(coverFiles[t]) message = "" if (audioOrText == True): message = fp.getMessageBits('C:/Users/Johan Gouws/Desktop/text.txt') message = list(map(str, message)) message = "".join(message) originalMessage = deepcopy(message) message = AES.encryptBinaryString(message, AESkeyEncode) message = list(map(int, list(message))) message = "".join(list(map(str, message))) originalCoverSamples = deepcopy(samplesOne) currentTime = time.time() stegoSamples, samplesUsed, capacityWarning = dwtOBH.dwtHaarEncode(samplesOne, message, OBHs[OBH_index], 512, '.txt') stegoSamples = np.asarray(stegoSamples, dtype=np.float32, order = 'C')/ 32768.0
message, fileType = dwtOBH.dwtHaarDecode(samplesOneStego, OBH, 512) fp.writeMessageBitsToFile(message, 'Pannekoekies4.wav') if (libraryImplement == True): # Open the cover audio song = wave.open('Media/song.wav', mode='rb') print("Getting cover samples") # Extract the wave samples from the host signal samplesOne, samplesTwo, rate = fp.getWaveSamples('Media/song.wav') print("Getting message samples") # Message to embed message = fp.getMessageBits('Media/cat.jpeg') message = "".join(list(map(str, message))) print("Encoding") stegoSamples, numEmbedded = dwtLibrary.dwtHaarEncodingLibrary(samplesOne, message, 4, 2048) print("Writing to stego") # Write to the stego song file fp.writeStegoToFile('Media/DWT.wav',song.getparams(), stegoSamples) print("Reading from stego") # Open the cover audio stego = wave.open('Media/DWT.wav', mode='rb')