| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::DAAP::Client::v3; | 
| 2 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 31 |  | 
| 3 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 23 |  | 
| 4 | 1 |  |  | 1 |  | 892 | use Digest::MD5::M4p; | 
|  | 1 |  |  |  |  | 1098 |  | 
|  | 1 |  |  |  |  | 341 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | # this is a translation of the GenerateHash function in hasher.c of | 
| 7 |  |  |  |  |  |  | # libopendaap http://crazney.net/programs/itunes/authentication.html | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | my @seeds; | 
| 10 |  |  |  |  |  |  | sub validate { | 
| 11 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 12 | 0 |  |  |  |  |  | my ($url, $select, $sequence) = @_; | 
| 13 | 0 | 0 |  |  |  |  | unless (@seeds) { | 
| 14 | 0 |  |  |  |  |  | for my $i (0..255) { | 
| 15 | 0 |  |  |  |  |  | my $ctx = Digest::MD5::M4p->new; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 0 | 0 |  |  |  |  | $ctx->add( $i & 0x40 ? "eqwsdxcqwesdc"      : "op[;lm,piojkmn" ); | 
| 18 | 0 | 0 |  |  |  |  | $ctx->add( $i & 0x20 ? "876trfvb 34rtgbvc"  :  "=-0ol.,m3ewrdfv" ); | 
| 19 | 0 | 0 |  |  |  |  | $ctx->add( $i & 0x10 ? "87654323e4rgbv " | 
| 20 |  |  |  |  |  |  | : "1535753690868867974342659792" ); | 
| 21 | 0 | 0 |  |  |  |  | $ctx->add( $i & 0x08 ? "Song Name"          : "DAAP-CLIENT-ID:" ); | 
| 22 | 0 | 0 |  |  |  |  | $ctx->add( $i & 0x04 ? "111222333444555"    : "4089961010" ); | 
| 23 | 0 | 0 |  |  |  |  | $ctx->add( $i & 0x02 ? "playlist-item-spec" : "revision-number" ); | 
| 24 | 0 | 0 |  |  |  |  | $ctx->add( $i & 0x01 ? "session-id"         : "content-codes" ); | 
| 25 | 0 | 0 |  |  |  |  | $ctx->add( $i & 0x80 ? "IUYHGFDCXWEDFGHN"   : "iuytgfdxwerfghjm" ); | 
| 26 | 0 |  |  |  |  |  | push @seeds, uc $ctx->hexdigest; | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 0 |  |  |  |  |  | my $ctx = Digest::MD5::M4p->new; | 
| 31 | 0 |  |  |  |  |  | $ctx->add( $url ); | 
| 32 | 0 |  |  |  |  |  | $ctx->add( "Copyright 2003 Apple Computer, Inc." ); | 
| 33 | 0 |  |  |  |  |  | $ctx->add( $seeds[ $select ]); | 
| 34 | 0 | 0 |  |  |  |  | $ctx->add( $sequence ) if $sequence; | 
| 35 | 0 |  |  |  |  |  | return uc $ctx->hexdigest; | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | 1; | 
| 39 |  |  |  |  |  |  | __END__ |