Hash functions[edit | edit source]

// 6D.113
NSTUB(0xFF939F68, md5);
NSTUB(0xFF8D819C, sha1);

int md5(msg, msg_len, char *outbuf); // 0 on success
int sha1(msg, msg_len, 0, char *outbuf); // 0 on success

CSEL - HMAC (keyed-hash message authentication code) functions[edit | edit source]

May be used to implement OAuth.

// 6D.113
NSTUB(0xFF8D32FC, CSEL_Mac_Init);
NSTUB(0xFF8D331C, CSEL_Mac_Update);
NSTUB(0xFF8D3350, CSEL_Mac_Final);
NSTUB(0xFF8D3374, CSEL_Mac_Free);

int res;
int ctx = 0;
char out[1024];
int len = sizeof(out);

res = CSEL_Mac_Init(&ctx, int method, char *key, int key_len); // returns 0 on success
res = CSEL_Mac_Update(ctx, "The quick brown fox jumps over the lazy dog", 43); // returns 0 on success
res = CSEL_Mac_Final(ctx, out, &len); // returns 0 on success. len now contains used length of out and out contains HMAC-<method>
res = CSEL_Mac_Free(ctx); // returns 0 on success

Known methods:

0x64 - HMAC-MD5
0x65 - HMAC-SHA1
0x67 - HMAC-SHA256
Community content is available under CC-BY-SA unless otherwise noted.