Hello I have an unsigned char * that looks (after printf) like this (it’s a SHA-1 hash):
n\374\363\327=\3103\231\361P'o]Db\251\360\316\203
I need to convert this unsigned char * to an unsigned int, what do you think it would be the best way to do it ? I have some ideas, but I’m not a C expert so wanted to see someone else ideas before trying my own stuff.
Why would you need a conversion? It’s a 160 bit long digest. Digests are used only in two ways:
You print a digest with something like
and compare against another digest with something like
It works just fine the way it is as a 20-byte long array of bytes. You don’t have to worry about endianness, word length, nothing.