Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Programmatically "corrupt" an mp3 file

Programmatically "corrupt" an mp3 file

Scheduled Pinned Locked Moved .NET (Core and Framework)
tutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GizmoC
    wrote on last edited by
    #1

    Hello I am trying to get my feet wet with I/O. Basically, I have an MP3 file that I want to "corrupt". At first, I thought merely adding some garbage bytes to the beginning would do the trick, but that doesnt work. For example, FileStream fs = new FileStream("try1.avi" , FileMode.Open, FileAccess.Write); fs.WriteByte(123); fs.Flush(); fs.Close(); After examining the edited file with a hex-editor, I noticed that the byte is correctly being added to the start of the file. However, WinAmp still plays the mp3. Infact, I started directly shifting bytes around with the hex editor and realised that the file still plays! (albeit a little messed up) Further research shows that this resilience is due to the format of the MP3 itself. It turns out an Mp3 file is divided into frames (each frame consisting of a header and data) which are independent of each other. So... well.. anyone have any clever ideas how I can programmatically "corrupt" the Mp3 file? Ofcourse, I need to do it in such a way that I can reverse the process! Regards,

    Y 1 Reply Last reply
    0
    • G GizmoC

      Hello I am trying to get my feet wet with I/O. Basically, I have an MP3 file that I want to "corrupt". At first, I thought merely adding some garbage bytes to the beginning would do the trick, but that doesnt work. For example, FileStream fs = new FileStream("try1.avi" , FileMode.Open, FileAccess.Write); fs.WriteByte(123); fs.Flush(); fs.Close(); After examining the edited file with a hex-editor, I noticed that the byte is correctly being added to the start of the file. However, WinAmp still plays the mp3. Infact, I started directly shifting bytes around with the hex editor and realised that the file still plays! (albeit a little messed up) Further research shows that this resilience is due to the format of the MP3 itself. It turns out an Mp3 file is divided into frames (each frame consisting of a header and data) which are independent of each other. So... well.. anyone have any clever ideas how I can programmatically "corrupt" the Mp3 file? Ofcourse, I need to do it in such a way that I can reverse the process! Regards,

      Y Offline
      Y Offline
      Yona Low
      wrote on last edited by
      #2

      Why don't you encrypt the file ? this way its theoretically corrupted and you can reverse it with the right password

      G 1 Reply Last reply
      0
      • Y Yona Low

        Why don't you encrypt the file ? this way its theoretically corrupted and you can reverse it with the right password

        G Offline
        G Offline
        GizmoC
        wrote on last edited by
        #3

        Interesting. Someone on another forums suggested a simple byte-reverse. That did the trick :) But encryption sounds cool too, I have no idea how to go about it tho. I'll look around. Guidance will be appreciated :) Thanks.

        Y 1 Reply Last reply
        0
        • G GizmoC

          Interesting. Someone on another forums suggested a simple byte-reverse. That did the trick :) But encryption sounds cool too, I have no idea how to go about it tho. I'll look around. Guidance will be appreciated :) Thanks.

          Y Offline
          Y Offline
          Yona Low
          wrote on last edited by
          #4

          There are countless of samples and articles on how to encrypt files here on the code project

          V 1 Reply Last reply
          0
          • Y Yona Low

            There are countless of samples and articles on how to encrypt files here on the code project

            V Offline
            V Offline
            Vasudevan Deepak Kumar
            wrote on last edited by
            #5

            http://www.codeproject.com/dotnet/xcrypt.asp[^]

            Vasudevan Deepak Kumar Personal Homepage Tech Gossips

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups