Created
May 3, 2014 22:50
-
-
Save wololodev/820398e0faf60539fc2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function encryptSID(sid) { | |
sid = String(sid); | |
var sidLength = sid.length; | |
var encryptedSID = []; | |
for (var index = 0; index < sidLength; index++) { | |
var e = sid.charAt(index); | |
switch (index) { | |
case 0: | |
switch (e) { | |
case "0": | |
encryptedSID[index] = "58"; | |
break; | |
case "1": | |
encryptedSID[index] = "59"; | |
break; | |
case "9": | |
encryptedSID[index] = "51"; | |
break; | |
default: | |
encryptedSID[index] = "??"; | |
} | |
break; | |
case 1: | |
switch (e) { | |
case "0": | |
encryptedSID[index] = "1f"; | |
break; | |
case "1": | |
encryptedSID[index] = "1e"; | |
break; | |
case "2": | |
encryptedSID[index] = "1d"; | |
break; | |
case "3": | |
encryptedSID[index] = "1c"; | |
break; | |
case "4": | |
encryptedSID[index] = "1b"; | |
break; | |
case "5": | |
encryptedSID[index] = "1a"; | |
break; | |
case "6": | |
encryptedSID[index] = "19"; | |
break; | |
case "7": | |
encryptedSID[index] = "18"; | |
break; | |
case "8": | |
encryptedSID[index] = "17"; | |
break; | |
case "9": | |
encryptedSID[index] = "16"; | |
break; | |
default: | |
encryptedSID[index] = "??"; | |
} | |
break; | |
case 2: | |
switch (e) { | |
case "0": | |
encryptedSID[index] = "aa"; | |
break; | |
case "1": | |
encryptedSID[index] = "ac"; | |
break; | |
case "2": | |
encryptedSID[index] = "af"; | |
break; | |
case "3": | |
encryptedSID[index] = "ae"; | |
break; | |
case "4": | |
encryptedSID[index] = "a9"; | |
break; | |
case "5": | |
encryptedSID[index] = "a8"; | |
break; | |
case "6": | |
encryptedSID[index] = "??"; | |
break; | |
case "7": | |
encryptedSID[index] = "??"; | |
break; | |
case "8": | |
encryptedSID[index] = "??"; | |
break; | |
case "9": | |
encryptedSID[index] = "??"; | |
break; | |
default: | |
encryptedSID[index] = "??"; | |
} | |
break; | |
case 3: | |
switch (e) { | |
case "0": | |
encryptedSID[index] = "87"; | |
break; | |
case "1": | |
encryptedSID[index] = "86"; | |
break; | |
case "2": | |
encryptedSID[index] = "85"; | |
break; | |
case "3": | |
encryptedSID[index] = "84"; | |
break; | |
case "4": | |
encryptedSID[index] = "83"; | |
break; | |
case "5": | |
encryptedSID[index] = "82"; | |
break; | |
case "6": | |
encryptedSID[index] = "81"; | |
break; | |
case "7": | |
encryptedSID[index] = "80"; | |
break; | |
case "8": | |
encryptedSID[index] = "8f"; | |
break; | |
case "9": | |
encryptedSID[index] = "8e"; | |
break; | |
default: | |
encryptedSID[index] = "??"; | |
} | |
break; | |
case 4: | |
switch (e) { | |
case "0": | |
encryptedSID[index] = "73"; | |
break; | |
case "1": | |
encryptedSID[index] = "72"; | |
break; | |
case "2": | |
encryptedSID[index] = "71"; | |
break; | |
case "3": | |
encryptedSID[index] = "70"; | |
break; | |
case "4": | |
encryptedSID[index] = "77"; | |
break; | |
case "5": | |
encryptedSID[index] = "76"; | |
break; | |
case "6": | |
encryptedSID[index] = "75"; | |
break; | |
case "7": | |
encryptedSID[index] = "74"; | |
break; | |
case "8": | |
encryptedSID[index] = "7b"; | |
break; | |
case "9": | |
encryptedSID[index] = "7a"; | |
break; | |
default: | |
encryptedSID[index] = "??"; | |
} | |
break; | |
case 5: | |
switch (e) { | |
case "0": | |
encryptedSID[index] = "89"; | |
break; | |
case "1": | |
encryptedSID[index] = "88"; | |
break; | |
case "2": | |
encryptedSID[index] = "8b"; | |
break; | |
case "3": | |
encryptedSID[index] = "8a"; | |
break; | |
case "4": | |
encryptedSID[index] = "8d"; | |
break; | |
case "5": | |
encryptedSID[index] = "8c"; | |
break; | |
case "6": | |
encryptedSID[index] = "8f"; | |
break; | |
case "7": | |
encryptedSID[index] = "8e"; | |
break; | |
case "8": | |
encryptedSID[index] = "81"; | |
break; | |
case "9": | |
encryptedSID[index] = "80"; | |
break; | |
default: | |
encryptedSID[index] = "??"; | |
} | |
break; | |
case 6: | |
switch (e) { | |
case "0": | |
encryptedSID[index] = "39"; | |
break; | |
case "1": | |
encryptedSID[index] = "38"; | |
break; | |
case "2": | |
encryptedSID[index] = "3b"; | |
break; | |
case "3": | |
encryptedSID[index] = "3a"; | |
break; | |
case "4": | |
encryptedSID[index] = "3d"; | |
break; | |
case "5": | |
encryptedSID[index] = "3c"; | |
break; | |
case "6": | |
encryptedSID[index] = "3f"; | |
break; | |
case "7": | |
encryptedSID[index] = "3e"; | |
break; | |
case "8": | |
encryptedSID[index] = "31"; | |
break; | |
case "9": | |
encryptedSID[index] = "30"; | |
break; | |
default: | |
encryptedSID[index] = "??"; | |
} | |
break; | |
} | |
} | |
return encryptedSID.join(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment