.net - How to edit and read the header of a MP3 file before encrypting it in c#? -


i encrypting mp3 file format, want is, should able write header of new format file. , want save duration of song in header of new format file. new file in encrypted format, want write duration in header. later on if need duration of encrypted song file, read header instead of decrypting whole file.

i writing code of mp3 encryption technique.

public static void encryptfile(string inputfile, string outputfile)        {             try            {                string password = @"mykey123"; // key here                unicodeencoding ue = new unicodeencoding();                byte[] key = ue.getbytes(password);                 string cryptfile = outputfile;                filestream fscrypt = new filestream(cryptfile, filemode.create);                 rijndaelmanaged rmcrypto = new rijndaelmanaged();                 cryptostream cs = new cryptostream(fscrypt,                    rmcrypto.createencryptor(key, key),                    cryptostreammode.write);                 filestream fsin = new filestream(inputfile, filemode.open);                 int data;                while ((data = fsin.readbyte()) != -1)                    cs.writebyte((byte)data);                  fsin.close();                cs.close();                fscrypt.close();            }            catch            {                console.writeline("encryption failed!", "error");            }        } 


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -