Class ByteArrayWavEncloser

java.lang.Object
de.das.encrypter.tools.ByteArrayEncloser
de.das.encrypter.tools.ByteArrayWavEncloser

public class ByteArrayWavEncloser extends ByteArrayEncloser
Byte array wav enclosers interweave the bits of the individual bytes of a byte array with the bytes of the audio data of an audio file in WAV format. The changes to the audio content are so minor that they are imperceptible to the naked ear. Enclosed can be the bytes of a simple byte array or the bytes of a file. The difference is that for the bytes of a file an additional identifier with the original file name is attached. The bits of the data to be hidden are hidden in the least significant bits of the volume values in both stereo channels.
  • Constructor Details

    • ByteArrayWavEncloser

      public ByteArrayWavEncloser()
    • ByteArrayWavEncloser

      public ByteArrayWavEncloser(ProgressListener pl)
  • Method Details

    • canHold

      public boolean canHold(int length, File f)
      Checks if the capacity of the given audio file is sufficient to hold the given number of bytes.
      Parameters:
      length - the number of bytes to be
      f - the file to be used as a container.
      Returns:
      true, if the container is able to hold the data.
    • canHoldFile

      public boolean canHoldFile(File f, File audio)
      Checks if the capacity of the given audio file is sufficient to hold the given file. Contrary to the capture of pure data, for files their name is still placed at the beginning.
      Parameters:
      f - the file to be woven into the container.
      audio - the file to be used as a container.
      Returns:
      true, if the audio file is able to hold the file data.
    • getCapacity

      public int getCapacity(File container)
      Calculates the maximum acquisition capacity of a given audio file under the condition that each volume value of both channels provide their LSB bit for the bits of the data to be woven in.
      Parameters:
      container - the wav file to be used as the container.
      Returns:
      the maximum acquisition capacity of the given audio file.
    • hideData

      public void hideData(byte[] d, File container) throws Exception
      Weaves the given data into the given audio file.
      Parameters:
      d - a given byte array.
      container - a given audio file.
      Throws:
      Exception - when the specified audio file is not able to capture the given data.
    • hideData

      public void hideData(byte[] d, File container, boolean withHeader) throws Exception
      Throws:
      Exception
    • containsHiddenFile

      public boolean containsHiddenFile(File container) throws Exception
      Throws:
      Exception
    • containsHiddenData

      public boolean containsHiddenData(File container) throws Exception
      Throws:
      Exception
    • regainData

      public byte[] regainData(File container) throws Exception
      Checks if the specified file contains hidden data and then starts to recover the data from the file.
      Parameters:
      container - a given file assumed it contains hidden data.
      Returns:
      the regained data or null, if the regaining process has been interrupted.
      Throws:
      Exception - if any error occurs.
    • getHiddenArraySize

      public int getHiddenArraySize(File f) throws Exception
      Get the amount of bytes hidden in the given file.
      Parameters:
      f - a given file.
      Returns:
      the number of bytes hidden in the given file.
      Throws:
      Exception - in case of any error.
    • assemble

      public byte[] assemble(File container, int count) throws Exception
      Throws:
      Exception
    • clear

      public void clear(File container) throws Exception
      Throws:
      Exception
    • breakIt

      public void breakIt()
      Set a flag that indicates to interrupt a running process immediately.
    • getHiddenFileName

      public String getHiddenFileName(File container) throws Exception
      Throws:
      Exception
    • getContainedBytes

      public byte[] getContainedBytes(File container, int count) throws Exception
      Throws:
      Exception