CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 19

Thread: problem in loop

Threaded View

  1. #1
    Join Date
    Apr 2006
    Posts
    587

    problem in loop

    Code:
    char *challengeConcat = "whatever.....";
    
    char hash1[88] = "edp{}e|wxrdse}}u666666666666666666666666666666666666666666666666";
    
    		char incoming[32]; 
    		
    		int x, y = 0;
    
    		for (x = 0; x < 32; x++, y++) 
    		{
    
    			if (0x5C == challengeConcat[y]) 
    			{
    				++y;
    
    				if (bValidEscape[challengeConcat[y]]) incoming[x] = esc2ascii[challengeConcat[y]];
    				else x--;
    				
    			}
    
    			else incoming[ x] = challengeConcat[y];
    		}
    
    and then what i do is
    memcpy(&hash1[64], incoming, 32);
    but i tried a shortcut to directly put the chars straight onto hash1, but it doesnt work properly, it just overwirtes part of the hash1 with some random garbage chars

    any ideas guys?

    Code:
    char *challengeConcat = "whatever.....";
    		char hash1[88] = "edp{}e|wxrdse}}u666666666666666666666666666666666666666666666666";
    		
    		int x, y = 0;
    
    		for (x = 0; x < 32; x++, y++) 
    		{
    
    			if (0x5C == challengeConcat[y]) 
    			{
    				++y;
    
    				if (bValidEscape[challengeConcat[y]]) hash1[strlen(hash1) - x] = esc2ascii[challengeConcat[y]];
    				else x--;
    				
    			}
    
    			else hash1[strlen(hash1) - x] = challengeConcat[y];
    		}
    Last edited by pouncer; August 12th, 2006 at 09:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured