All pastes #78011 Raw Edit

Someone

public text v1 · immutable
·published 2006-07-03 18:15 UTC
rendered paste body
from the C .h file:

void GenerateHash(short version_major,
                  const unsigned char *url, unsigned char hashSelect,
                  unsigned char *outhash,
                  int request_id);

from a .cpp:
void
ContentFetcher::getDaap( const QString & path )
{
    QHttpRequestHeader header( "GET", path );
    header.setValue( "Accept-Encoding", "gzip" );
    unsigned char hash[33] = {0};
    unsigned char unsignedPath[ path.length() ] = {0};
    for( uint i = 0; i< path.length() ; i++ ){
        unsignedPath[i] = reinterpret_cast<unsigned char>(path.ascii()[i]);
    }
    
    GenerateHash(3, unsignedPath , 2, hash, s_requestId);
    header.setValue( "User-Agent", "iTunes/4.6 (Windows; N)" );
    header.setValue( "Client-DAAP-Version", "3.0" );
    for( int i = 0; i < 33 ; i++ ){
        hash[i] = reinterpret_cast<const char*>(hash[i]);
    }
    header.setValue( "Client-DAAP-Validation", reinterpret_cast<const char*>(hash) );
    header.setValue( "Client-DAAP-Access-Index", "2" );
    header.setValue( "Client-DAAP-Request-ID", QString::number( s_requestId ) );
    request( header );
    debug() << hash << ' ' << path.ascii() << ' ' << reinterpret_cast<const unsigned char*>(path.ascii()) << endl;
}