c# - How to MD5 encrypt using Challenge Key -


i trying establish connection server using md5 authentication. server returns me challenge key. how can use encrypt password , send server. encryption method know needs password hash, salt key, , vi code. how can make .

    static readonly string passwordhash = "passwordhash";     static readonly string saltkey = "saltkey";     static readonly string vikey = "@1b2c3d4e5f6g7h8";      public static string encrypt(string plaintext)     {         byte[] plaintextbytes = encoding.utf8.getbytes(plaintext);          byte[] keybytes = new rfc2898derivebytes(passwordhash, encoding.ascii.getbytes(saltkey)).getbytes(256 / 8);         var symmetrickey = new rijndaelmanaged() { mode = ciphermode.cbc, padding = paddingmode.zeros };         var encryptor = symmetrickey.createencryptor(keybytes, encoding.ascii.getbytes(vikey));          byte[] ciphertextbytes;          using (var memorystream = new memorystream())         {             using (var cryptostream = new cryptostream(memorystream, encryptor, cryptostreammode.write))             {                 cryptostream.write(plaintextbytes, 0, plaintextbytes.length);                 cryptostream.flushfinalblock();                 ciphertextbytes = memorystream.toarray();                 cryptostream.close();             }             memorystream.close();         }         return convert.tobase64string(ciphertextbytes); 


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -