static void escape( char * out, const uint8_t * in, int in_len ) /* rfc2396 */ { const uint8_t *end = in + in_len; while( in != end ) if( is_rfc2396_alnum(*in) ) *out++ = (char) *in++; else out += tr_snprintf( out, 4, "%%%02X", (unsigned int)*in++ ); *out = '\0'; }
void tr_http_escape_sha1( char * out, const uint8_t * sha1_digest ) { const uint8_t * in = sha1_digest; const uint8_t * end = in + SHA_DIGEST_LENGTH; while( in != end ) if( is_rfc2396_alnum( *in ) ) *out++ = (char) *in++; else out += tr_snprintf( out, 4, "%%%02x", (unsigned int)*in++ ); *out = '\0'; }