WOL Apgar Routine

Sean Wragg
Sean’s Blog
Published in
Aug 26, 2010
Westwood Studios © EA

APGAR is an encrypted token sent to the server to identify a user’s password. This is a one-way encryption routine and cannot be decrypted. All legacy Command and Conquer game client passwords using this algorithm must be exactly 8 characters long.

Psuedo-code implementation

function apgar(input)  
lookup = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
out = ""
i = 1

while (i <= 8)
left = ascii value of input[ i ]
right = ascii value of input[ length[input] - i ]

if left is odd
x = ((left * 2) XOR (left AND 1)) AND right
else
x = left XOR right

out += lookup[x AND 63]
i++

return out

PHP Implementation (Sean Wragg)

Javascript Implementation (Sean Wragg)

C++ Implementation (RenegadeProjects.com)

mIRC Script Implementation (Frank Razenberg)

Originally published at seanwragg.com on August 26, 2010.

--

--