I'm having a small issue getting the sha1 function to work in G-WAN.
Basically i have the string i want to hash, I'm new to C in general so any pointers would be great.
This is the string im trying to sha1 hash, I'v tried several approaches but I'm not sure what I'm doing wrong.
u8 *input = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
I almost have websockets working with G-wan and the last thing is getting this sha1 function to cooperate with me.
Documentation on G-wans sha1 function is below
// u8 dst[20]; // the resulting 160-bit hash
// sha1_t ctx;
// sha1_init(&ctx);
// int i = 10;
// while(i--)
// sha1_add(&ctx, data[i].ptr, data[i].len);
// sha1_end(&ctx, dst);
typedef struct { u8 x[220]; } sha1_t;
void sha1_init(sha1_t *ctx);
void sha1_add (sha1_t *ctx, u8 *src, int srclen);
void sha1_end (sha1_t *ctx, u8 *dst);
// a wrapper on all the above SHA-160 calls
void sha1(u8 *input, int ilen, u8 *dst);
Link to there api http://gwan.com/api
If anyone could throw me a bone here It would make my last hours with C a tad bit forgiving.