XWIS:APGAR
Appearance
APGAR is a token sent by a C&C game to tell XWIS the players' password. The password is encrypted using a weak algorithm.
Example (decrypted password "reneproj"):
apgar Ykbcaxop 0
The closing zero seems to have a special function.
Algorithm to calculate encrypted password:
string apgar(string input) {
lookup = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
out = ""
i = 1
while (i <= 8) {
left = input[i]
right = input[length[input] - i + 1]
x = left & 1 ? ((left << 1) ^ (left & 1)) & right : left ^ right
out += lookup[x & 63]
i++
}
return out
}