Click here to Skip to main content
15,892,298 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhelp me to generate MD5 of Binary hash value. Pin
Le@rner26-Dec-13 21:33
Le@rner26-Dec-13 21:33 
AnswerRe: help me to generate MD5 of Binary hash value. Pin
Richard MacCutchan26-Dec-13 22:25
mveRichard MacCutchan26-Dec-13 22:25 
GeneralRe: help me to generate MD5 of Binary hash value. Pin
Le@rner26-Dec-13 23:45
Le@rner26-Dec-13 23:45 
GeneralRe: help me to generate MD5 of Binary hash value. Pin
Richard MacCutchan27-Dec-13 0:08
mveRichard MacCutchan27-Dec-13 0:08 
GeneralRe: help me to generate MD5 of Binary hash value. Pin
Le@rner27-Dec-13 2:03
Le@rner27-Dec-13 2:03 
GeneralRe: help me to generate MD5 of Binary hash value. Pin
Richard MacCutchan27-Dec-13 3:26
mveRichard MacCutchan27-Dec-13 3:26 
GeneralRe: help me to generate MD5 of Binary hash value. Pin
Randor 27-Dec-13 10:51
professional Randor 27-Dec-13 10:51 
GeneralRe: help me to generate MD5 of Binary hash value. Pin
Le@rner27-Dec-13 17:30
Le@rner27-Dec-13 17:30 
thanks randor

can u help me to convert c# code in c++;

my code works gud in c# but I have not so much idea how these functions works in c++

C#
static string convert_byte_array_to_string(byte[] byte_array)
        {
            // Convert the encrypted bytes back to a string (base 16)
            string hashString = "";
 
            for (int i = 0; i < byte_array.Length; i++)
            {
                hashString += Convert.ToString(byte_array[i], 16).PadLeft(2, '0');
            }
 
            return hashString;
        }
 
 //////////////////
//inside my function

                 //////////////////
                MD5 md5Hash = MD5.Create();
 
              
                byte[] str_Buf = System.Text.UnicodeEncoding.Unicode.GetBytes(value_str);
                hashString = Form1.convert_byte_array_to_string(str_Buf);
 

                byte[] strHash = md5Hash.ComputeHash(str_Buf);
                hashString = Form1.convert_byte_array_to_string(strHash);
 
               
                byte[] hashBuf = new byte[21 * 16];
                for (int i = 0; i < 16; i++)
                {
                    Array.Copy(strHash, 0, hashBuf, i * 21, 5);
                    Array.Copy(verifierBuf, 0, hashBuf, i * 21 + 5, 16);
                }
 
                
                hashString = Form1.convert_byte_array_to_string(hashBuf);
 

            
                strHash = md5Hash.ComputeHash(hashBuf);
                hashString = Form1.convert_byte_array_to_string(strHash);
 
            
                uint block = 0;
                Array.Copy(strHash, 0, hashBuf, 0, 5);
                Array.Copy(BitConverter.GetBytes(block), 0, hashBuf, 5, 4);
 
                hashString = Form1.convert_byte_array_to_string(hashBuf);
 
                strHash = md5Hash.ComputeHash(hashBuf, 0, 9);
                hashString = Form1.convert_byte_array_to_string(strHash);
 
             
                byte[] rc4Key = new byte[16];
 
                Array.Copy(strHash, rc4Key, 16); // 5 bytes = 40 bits
                hashString = Form1.convert_byte_array_to_string(rc4Key);
 
             
                ManagedRC4.RC4 rc4 = new ManagedRC4.RC4();
 
                rc4.Init(rc4Key, (uint)rc4Key.Length);
 
                rc4.Decrypt(encryptedVerifier, (uint)encryptedVerifier.Length);
                rc4.Decrypt(encryptedVerifierHash, (uint)encryptedVerifierHash.Length);
               
                hashString = Form1.convert_byte_array_to_string(encryptedVerifier);
                hashString = Form1.convert_byte_array_to_string(encryptedVerifierHash);
 

               byte[] hashedVerifier = md5Hash.ComputeHash(encryptedVerifier);
 
                hashString = Form1.convert_byte_array_to_string(hashedVerifier);
                hashString = Form1.convert_byte_array_to_string(encryptedVerifier);
 
                               md5Hash.Clear();
                /////////////////

please.


can I create dll for c code and use in my c++ code.

can u please help me for this.

modified 28-Dec-13 7:22am.

QuestionPointers in C/C++ Pin
tgsb26-Dec-13 20:24
tgsb26-Dec-13 20:24 
AnswerRe: Pointers in C/C++ Pin
Richard MacCutchan26-Dec-13 22:23
mveRichard MacCutchan26-Dec-13 22:23 
AnswerRe: Pointers in C/C++ Pin
jschell27-Dec-13 12:54
jschell27-Dec-13 12:54 
JokeRe: Pointers in C/C++ Pin
enhzflep4-Jan-14 8:26
enhzflep4-Jan-14 8:26 
QuestionXML parsing in QT Pin
Utheen26-Dec-13 16:44
Utheen26-Dec-13 16:44 
AnswerRe: XML parsing in QT Pin
Albert Holguin27-Dec-13 4:20
professionalAlbert Holguin27-Dec-13 4:20 
GeneralRe: XML parsing in QT Pin
Utheen29-Dec-13 20:48
Utheen29-Dec-13 20:48 
AnswerRe: XML parsing in QT Pin
Albert Holguin30-Dec-13 7:05
professionalAlbert Holguin30-Dec-13 7:05 
QuestionDynamically updating image (PNG) Pin
Don Guy26-Dec-13 12:53
Don Guy26-Dec-13 12:53 
AnswerRe: Dynamically updating image (PNG) Pin
Albert Holguin26-Dec-13 15:25
professionalAlbert Holguin26-Dec-13 15:25 
Questionhow to know file type and its protection type for office files? Pin
Le@rner24-Dec-13 1:22
Le@rner24-Dec-13 1:22 
SuggestionRe: how to know file type and its protection type for office files? Pin
Richard MacCutchan24-Dec-13 4:23
mveRichard MacCutchan24-Dec-13 4:23 
GeneralRe: how to know file type and its protection type for office files? Pin
Le@rner25-Dec-13 18:23
Le@rner25-Dec-13 18:23 
GeneralRe: how to know file type and its protection type for office files? Pin
Richard MacCutchan25-Dec-13 23:57
mveRichard MacCutchan25-Dec-13 23:57 
QuestionDirectShow - video resize interpolation Pin
sdancer7523-Dec-13 22:09
sdancer7523-Dec-13 22:09 
AnswerRe: DirectShow - video resize interpolation Pin
sdancer757-Jan-14 23:20
sdancer757-Jan-14 23:20 
AnswerRe: DirectShow - video resize interpolation Pin
sdancer754-Mar-14 21:52
sdancer754-Mar-14 21:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.