All pastes #944891 Raw Edit

Meins

public text v1 · immutable
·published 2008-03-16 15:22 UTC
rendered paste body
/* Convert a 20-byte hash value to a 45-byte human-readable value */
void otrl_privkey_hash_to_human(char human[45], const unsigned char hash[20])
{
    int word, byte;
    char *p = human;

    for(word=0; word<5; ++word) {
>-------for(byte=0; byte<4; ++byte) {
>-------    sprintf(p, "%02X", hash[word*4+byte]);
>-------    p += 2;
>-------}
>-------*(p++) = ' ';
    }
    /* Change that last ' ' to a '\0' */
    --p;
    *p = '\0';
}