How Does the GET_UINT32 Macro Convert Input into Hexadecimal Format?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
cutesteph
Messages
62
Reaction score
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:
Physics news on Phys.org
cutesteph said:

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.