Welcome to pickSourcecode.com Login | Register    
pickZy.com
 Home  | search  | games  | General  | C  | C++  | Java  | Php  | Networking  | Visual Basic  | VC++  | Win32  | MFC  | JavaScript  | Jobs  | Post jobs
Convert hex string ( 32 bytes ) to hex (16 bytes )
2010-01-18 |  RatheeshTR  | Viewed: 46  |    0

int stringtoint(u_char byte)
{
if(isdigit(byte))
{
return (byte - '0');
}
if(byte >  0x40)
{
return  (byte - 'A' + 10);
}
return (byte - '1' + 10);
}

u_char* strTohex(
char *src)
{
unsigned  
char *key = (u_char*) malloc(16 + 1);
int i;

memset(key, 0, 16);
for (i = 0; i < 16; i++){

key[i]  =  stringtoint(*src++) << 4;
key[i] |=  stringtoint(*src++);
}
return key;
}

Submitted By:
Prof: Software Engineer
Tech: C ,Cpp
Send Mail: ratheesh



Related topics
C - time_t ,Convert a time value to and from UTC time
C - strtok example, Splitting string into tokens
C - my strcpy ,string copy
C String permutation sample program ABCD
C String permutation program
C Program to Convert Integer to String
Create Child Process - fork(): Sample program
Convert hex string ( 32 bytes ) to hex (16 bytes )

Related References
c - constants, string constants, integer constants, character constants, enum
ipc (inter process communication) - message queues

Web site contents © Copyright 2007, All rights reserved.
Help | Terms and Conditions | Privacy Policy | About Us