| 1 | package Net::DAAP::Client::v3; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 0 | ▶ | use Digest::MD5::M4p; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 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 | my $self = shift; | ||
| 12 | my ($url, $select, $sequence) = @_; | ||
| 13 | unless (@seeds) { | ||
| 14 | for my $i (0..255) { | ||
| 15 | my $ctx = Digest::MD5::M4p->new; | ||
| 16 | |||
| 17 | $ctx->add( $i & 0x40 ? "eqwsdxcqwesdc" : "op[;lm,piojkmn" ); | ||
| 18 | $ctx->add( $i & 0x20 ? "876trfvb 34rtgbvc" : "=-0ol.,m3ewrdfv" ); | ||
| 19 | $ctx->add( $i & 0x10 ? "87654323e4rgbv " | ||
| 20 | : "1535753690868867974342659792" ); | ||
| 21 | $ctx->add( $i & 0x08 ? "Song Name" : "DAAP-CLIENT-ID:" ); | ||
| 22 | $ctx->add( $i & 0x04 ? "111222333444555" : "4089961010" ); | ||
| 23 | $ctx->add( $i & 0x02 ? "playlist-item-spec" : "revision-number" ); | ||
| 24 | $ctx->add( $i & 0x01 ? "session-id" : "content-codes" ); | ||
| 25 | $ctx->add( $i & 0x80 ? "IUYHGFDCXWEDFGHN" : "iuytgfdxwerfghjm" ); | ||
| 26 | push @seeds, uc $ctx->hexdigest; | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | my $ctx = Digest::MD5::M4p->new; | ||
| 31 | $ctx->add( $url ); | ||
| 32 | $ctx->add( "Copyright 2003 Apple Computer, Inc." ); | ||
| 33 | $ctx->add( $seeds[ $select ]); | ||
| 34 | $ctx->add( $sequence ) if $sequence; | ||
| 35 | return uc $ctx->hexdigest; | ||
| 36 | } | ||
| 37 | |||
| 38 | 1; | ||
| 39 | __END__ | ||