coverFiles = [ 'C:/Users/Johan Gouws/Desktop/Survey/A_Alternative_kite-as_worlds_collide.wav', 'C:/Users/Johan Gouws/Desktop/Survey/A_Blues_Big_Steve___the_Trainwreck-Sorry_.wav', 'C:/Users/Johan Gouws/Desktop/Survey/A_Electronic_Effective_Now-Complete.wav', '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 = "" messageObject = open( 'C:/Users/Johan Gouws/Desktop/Audio-Steganograpy/src/Media/text.txt', "r") # Extract the message as a string of characters message = messageObject.read() messageObject.close() originalCoverSamples = deepcopy(samplesOne) currentTime = time.time() stegoSamples, samplesUsed, capacityWarning = dwtEncrypt.dwtEncryptEncode(
coverFiles = [] for r, d, f in os.walk(path): for file in f: if '.wav' in file: 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
print("##################################################") print("# Hiding opera.wav into song.wav #") print("##################################################") secretMessage = "" # Get the audio samples in integer form converted to binary print("Getting message samples") intSamples = fp.extractWaveMessage("Media/opera.wav") # Convert to integer list of bits for embedding secretMessage = "".join(intSamples[0]) secretMessage = list(map(int, list(secretMessage))) print("Getting cover samples") coverSamplesOne, coverSamplesTwo, rate = fp.getWaveSamples( "Media/song.wav") for i in range(0, len(coverSamplesOne)): if (coverSamplesOne[i] <= -32768): coverSamplesOne[i] += 1 coverSamples = [coverSamplesOne, coverSamplesTwo] # Convert ASCII to binary binaryKey = fp.messageToBinary("xrdpkd8x") binaryKey = binaryKey * int( (len(secretMessage) + float(len(secretMessage)) / len(binaryKey))) print("Encoding") stegoSamples = GA_encoding(coverSamples, secretMessage, binaryKey, rate, fileType)
print("") ############################################################################### ############# Testing coeff generation level 1 vs library ################## ############################################################################### if (testLevelOneDWT == True): print("############# Testing level 1 ########\n") levels = 1 # Open the cover audio song = wave.open('Media/opera.wav', mode='rb') # Extract the wave samples from the host signal samplesOne, samplesTwo, rate = fp.getWaveSamples(song) # Make the signal equal to block to process while (len(samplesOne) % 1024 != 0): samplesOne.pop() a, d = firstP.getLevelCoefficients(levels ,samplesOne) aLib, dLib = pywt.wavedec(samplesOne, pywt.Wavelet('haar'), level = levels) apprDiff = [] detlDiff = [] signalDifferences = []
for path in allPaths: coverFiles = [] for r, d, f in os.walk(path): for file in f: if '.wav' in file: coverFiles.append(os.path.join(r, file)) coverFiles = coverFiles[0:numSongsPerGenre] for t in coverFiles: # Receive the message file fileType = '.txt' samplesOne, samplesTwo, rate = fp.getWaveSamples(t) message = "" AESkeyEncode = 'AES_KEY' if (fileType == ".wav"): # Get the audio samples in integer form intSamples = fp.extractWaveMessage('Media.ShortOpera.wav') # Convert to integer list of bits for embedding message = "".join(intSamples[0]) message = AES.encryptBinaryCTRString(message, AESkeyEncode) message = list(map(int, list(message)))
coverFiles.append(os.path.join(r, file)) coverFiles = coverFiles[0:numSongsPerGenre] for t in coverFiles: # Encoding ######################################### AESkeyEncode = "THIS_IS_THE_KEY_USED_FOR_AES_ENCRYPTION" stegoSamples = [] # Get the string representation of the key in ASCII keyString = "THIS_IS_THE_KEY_USED_FOR_GA_ENCRYPTION" coverSamplesOne, coverSamplesTwo, rate = fp.getWaveSamples(t) for i in range(0, len(coverSamplesOne)): if (coverSamplesOne[i] <= -32768): coverSamplesOne[i] += 1 coverSamples = [coverSamplesOne, coverSamplesTwo] if (audioOrText == True): secretMessage = "" secretMessage = fp.getMessageBits( 'C:/Users/Johan Gouws/Desktop/Audio-Steganograpy/src/Media/text.txt' ) secretMessage = list(map(str, secretMessage)) secretMessage = ''.join(secretMessage) originalMessage = deepcopy(secretMessage)
for path in allPaths: coverFiles = [] for r, d, f in os.walk(path): for file in f: if '.wav' in file: coverFiles.append(os.path.join(r, file)) coverFiles = coverFiles[0:numSongsPerGenre] if (textMessage == True): for t in coverFiles: for OBH_index in range(0, len(OBHs)): AESkeyEncode = "THIS_IS_THE_KEY_USED_FOR_AES_ENCRYPTION" samplesOne, samplesTwo, rate = fp.getWaveSamples(t) 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: