# pandora.com v15 xmlrpc encrypt/decrypt routines
# for data sent to /radio/xmlrpc/v15 in a POST
# usage:
# _xmlrpc_request_ = pandora_decrypt(_POST_data_)
# _POST_data_ = pandora_encrypt(_xmlrpc_request_)
def blowfish_round_function(XL):
F = S[0][XL>>24]
F += S[1][(XL>>16)&0xff]
F &= 0xffffffff
F ^= S[2][(XL>>8)&0xff]
F += S[3][XL&0xff]
F &= 0xffffffff
return F
def blowfish_intlist_decrypt(Li):
Lo = []
for i in xrange(0, len(Li), 2):
Lo.extend(blowfish_block_decrypt(Li[i], Li[i+1]))
return Lo
def blowfish_intlist_encrypt(Li):
Lo = []
for i in xrange(0, len(Li), 2):
Lo.extend(blowfish_block_encrypt(Li[i], Li[i+1]))
return Lo
def hexstr_to_intlist(H):
L = []
Hl = len(H)
Hm = Hl%8
for i in xrange(0, Hl-Hm, 8):
L.append(int(H[i:i+8],16))
if Hm > 0:
L.append(int(H[Hl-Hm:]+('0'*(8-Hm)),16))
return L
def intlist_to_hexstr(L):
H = ""
for I in L:
s = hex(I).replace('0x','').replace('L','')
H += ('0'*(8-len(s)))+s
return H
def str_to_intlist(S):
L = []
Sl = len(s)
Sm = Sl%4
if Sm > 0:
S += chr(0)*(4-Sm)
for i in xrange(0, len(S), 4):
L.append((ord(S[i])<<24)+(ord(S[i+1])<<16)+(ord(S[i+2])<<8)+ord(S[i+3]))
return L
def intlist_to_str(L):
S = ""
for I in L:
S += chr(I>>24&0xff)+chr(I>>16&0xff)+chr(I>>8&0xff)+chr(I&0xff)
return S
Most C and C++ compilers will -- depending on the target architecture -- emit different machine code for a chain of ifs and a switch/case statement. Basically, switch/case is a big hint to the compiler that it might want to consider using branching using lookup tables rather than repeated compare and branch.
Name:
Anonymous2008-02-01 6:16
>>40
And recursion is also ``just a glorified, limited goto''. Yes, it exists, and yes, it's useful in some situations. But you should still avoid it like the plague, since recursion can always be replaced by copying and pasting code.
Name:
Anonymous2008-02-01 6:27
Branching considered harmful.
Name:
Anonymous2008-02-01 6:29
>>42
I know you're kopiping, but recursion isn't just a goto; it also requires some sort of stack.
Assuming a non-tail call optimized language, recursion involves calling itself, which obviously uses the stack for the arguments and return address. It also implies that previous stack frames be saved as well,
Name:
Anonymous2008-02-01 8:24
>>46
','? what after the comma?
No, it does not imply a stack, are you telling me you have never seen an implementation of lisp on some machine that doesn't use a stack?
Recursion could be implemented with anything arbitrary, whether it's a RAM model, a stack datatype, 1-0 gates, other.
Name:
Anonymous2008-02-01 8:26
>>47
Yes it does. We're talking about the abstract data type here, not the implementation of on a particular architecture.
'-._ ___.....___
`.__ ,-' ,-.`-, Python and tail-
`''-------' ( p ) `._ calls go together
`-' ( like car and cdr.
\ And I'd also like
. \ to ask,
\---..,--' HAVE YOU READ
................._ --...--, YOUR SICP TODAY?
`-.._ _.-'
`'-----''
Name:
Anonymous2008-02-01 17:47
>>24
So... next question is how I actually authenticate... I get the syncId on sync, but no clue what I do with that? do I use that as a new key? What are the parameters for authenticateListener?
Name:
Anonymous2008-02-01 19:20
>>51
The sync method just returns the server's timestamp. However, it is encrypted using a different set of boxes (I'll post them below.) The client then uses (that timestamp + seconds elapsed) in all future method calls as the first parameter.
So, the authenticateListener method takes three parameters - the timestamp, your username (email address) and your password.
Or you can use createListener for an anonymous login; this takes only the timestamp as a parameter, and returns a set of key/value pairs describing your login.
You need the listener id and auth token for future requests - the auth token becomes your second parameter, and the lid is passed as an URL parameter.
>>52
You're amazing! Now, do you know how to go from the fragment's given "audioURL" to the real one? I'm sooo close to listening to pandora from my ipod touch I can...um... almost ... hear it...
Name:
Anonymous2008-02-02 9:25
>>55
Note that the last 48 characters of audioURL are composed entirely of hexadecimal characters. You might want to translate it to something more consistent with the rest of the URL.
Name:
Anonymous2008-02-02 13:04
Yeah, I had noticed that (and assumed I could decrypt it as well, which indeed appeared to be base64) but apparently, I was comparing the wrong two url's, because that seems to be it... but I saw other differences before...
So it works! Thanks!
Although, I don't know where some of these parameters are actually coming from (the rid for example... I can just make that up and it works... so far?) and getFragments has 2 other parameters that I have no clue where they came from... but it works without them?
The rid (route id) can be anything, but the flash file generates it from the last seven digits of ActionScript's getTime(). I'm not sure about the parameters of getFragments either - apart from the station id, the others appear to be the amount of time the station has been playing (in ms), the amount of time since it was last played (?), the station seed (?) and some sort of tracking code.
Name:
Anonymous2008-02-02 17:18
>>40
Doesn't recursion require more overhead than iteration, typically?
>>62
So, recursion requires more overhead than iteration except in cases where it's treated exactly like iteration. The word you were looking for was just "yes".
Name:
Anonymous2008-02-03 0:37
'-._ ___.....___
`.__ ,-' ,-.`-,
`''-------' ( p ) `.
`-' ; Picture me eating
\ my own tail.
. \
\---..,--' HAVE YOU READ
................._ --...--, YOUR SICP TODAY?
`-.._ _.-'
`'-----''
FUCKING REDDIT PIECE OF SHIT MOTHERFUCKERS GOD DAMN FUCKING REDDIT ILL GATHER A SHITLOAD OF FUCKING BOTS AND DDOS THAT FUCKING GAYASS HOMOPHILIC WEBSHIT
FUCKING GOD DAMMIT GOD FUCK FUCK SHIT CRAP ASS MOTHERFUCKER
FUCKING HOMO FAGGOT NIGGER CHINK MOTHERFUCKER OKRA DICK PIECEOF SHIT FAGGOT MOTHERFUCKER GOD DAMMIT CUNTSLAP PUSSY ASS NIGGER FAGGOT ASS MOTHERFUCKER
STOP POSTING FUCKING 4CHAN TO FUCKING REDDIT YOU FAGGOT MOTHERFUCKER NYPA SON OF A BITCH MOTHERFUCKER CUNT PIECE OF SHIT ASS WHORE
MOTHERFUCK
SERIOUSLY WHAT THE FUCK IS THAT FUCKING FAGGOT
FUCKING REDDIT PIECE OF SHIT MOTHERFUCKERS GOD DAMN FUCKING REDDIT ILL GATHER A SHITLOAD OF FUCKING BOTS AND DDOS THAT FUCKING GAYASS HOMOPHILIC WEBSHIT
FUCKING GOD DAMMIT GOD FUCK FUCK SHIT CRAP ASS MOTHERFUCKER
FUCKING HOMO FAGGOT NIGGER CHINK MOTHERFUCKER OKRA DICK PIECEOF SHIT FAGGOT MOTHERFUCKER GOD DAMMIT CUNTSLAP PUSSY ASS NIGGER FAGGOT ASS MOTHERFUCKER
72 Name: Anonymous : 2008-02-03 08:18
CUNTSLAP BITCHMOTHERFUCKER GODFUCKINGDAMMIT
I HOPE I WAS UCKING CLEACR OIFUCJATEOAMETO FUCK YOU MOTHERUFGGCKER
73 Name: Anonymous : 2008-02-03 08:21
MOTHERFUCK IM PISSED TO NO FUCKING END
SON OF A BTICH FAGGOT GODAMN FUCKING COCKSUCKER MOTHERGFUCKER [/b][/i][/u]
STOP POSTING FUCKING 4CHAN TO FUCKING REDDIT YOU FAGGOT MOTHERFUCKER NYPA SON OF A BITCH MOTHERFUCKER CUNT PIECE OF SHIT ASS WHORE
MOTHERFUCK
SERIOUSLY WHAT THE FUCK IS THAT FUCKING FAGGOT
FUCKING REDDIT PIECE OF SHIT MOTHERFUCKERS GOD DAMN FUCKING REDDIT ILL GATHER A SHITLOAD OF FUCKING BOTS AND DDOS THAT FUCKING GAYASS HOMOPHILIC WEBSHIT
FUCKING GOD DAMMIT GOD FUCK FUCK SHIT CRAP ASS MOTHERFUCKER
FUCKING HOMO FAGGOT NIGGER CHINK MOTHERFUCKER OKRA DICK PIECEOF SHIT FAGGOT MOTHERFUCKER GOD DAMMIT CUNTSLAP PUSSY ASS NIGGER FAGGOT ASS MOTHERFUCKER
72 Name: Anonymous : 2008-02-03 08:18
CUNTSLAP BITCHMOTHERFUCKER GODFUCKINGDAMMIT
I HOPE I WAS UCKING CLEACR OIFUCJATEOAMETO FUCK YOU MOTHERUFGGCKER
73 Name: Anonymous : 2008-02-03 08:21
MOTHERFUCK IM PISSED TO NO FUCKING END
SON OF A BTICH FAGGOT GODAMN FUCKING COCKSUCKER MOTHERGFUCKER [/b][/i][/u]