C programming hexidecimal

  • #1
63
0

Homework Statement


this is in my function
GET_UINT32( X, input, 0 );

this is a macro
#define GET_UINT32(n,b,i) \
{ \
(n) = ( (uint32) (b)[(i) ] << 24 ) \
| ( (uint32) (b)[(i) + 1] << 16 ) \
| ( (uint32) (b)[(i) + 2] << 8 ) \
| ( (uint32) (b)[(i) + 3] ); \
}

3435973836=0xcccccccc
when inputted into the macro, it out puts
0x4E6F7726 =1315927840.


Oxcc, Oxcc, Oxcc, Oxcc, Oxcc, Oxcc, Oxcc, Oxcc
into
0x4E, 0x6F, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74

The Attempt at a Solution


I am not sure how to begin. I am taking a cryptography class [/B]for fun as a statistics major. I tried understanding it but it just confused me. I want to see how (uint32) (b)[(i) + 1] << 16 ) changes the input
 
Last edited:
  • #2

Homework Statement


this is in my function
GET_UINT32( X, input, 0 );

this is a macro
#define GET_UINT32(n,b,i) \
{ \
(n) = ( (uint32) (b)[(i) ] << 24 ) \
| ( (uint32) (b)[(i) + 1] << 16 ) \
| ( (uint32) (b)[(i) + 2] << 8 ) \
| ( (uint32) (b)[(i) + 3] ); \
}

3435973836=0xcccccccc
when inputted into the macro, it out puts
0x4E6F7726 =1315927840.


Oxcc, Oxcc, Oxcc, Oxcc, Oxcc, Oxcc, Oxcc, Oxcc
into
0x4E, 0x6F, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74

The Attempt at a Solution


I am not sure how to begin. I am taking a cryptography class [/B]for fun as a statistics major. I tried understanding it but it just confused me. I want to see how (uint32) (b)[(i) + 1] << 16 ) changes the input
Please show us all of your code.
 
  • #3
and use the code tags when you do it.
 

Suggested for: C programming hexidecimal

Replies
8
Views
361
Replies
11
Views
653
Replies
4
Views
730
Replies
7
Views
1K
Replies
2
Views
635
Replies
2
Views
3K
Replies
2
Views
502
Replies
12
Views
804
Replies
1
Views
667
Back
Top