Signed fixes

Fixes all warnings due to casting/signedness (Lets pretend that is a word...)

Unit tests passing on 32 & 64 bit simulators

No warnings or static analyzer errors on either architectures

Typehash is now signed as it should be as it is used as a column in sqlite.