Created
June 14, 2012 17:15
-
-
Save saebekassebil/2931579 to your computer and use it in GitHub Desktop.
DanID string decryption
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 decryptDanIDString(string) { | |
var i = 42, j = string.length - 4, k, decoded = ''; | |
for(k = 0; k < j; k++) { | |
var m = string[k + 4]; | |
var mcode = m.charCodeAt(0); | |
if(mcode > 31 && mcode < 127) { | |
var tmpcode = (i + string[k].charCodeAt(0) + mcode) % 95 + 32; | |
i = tmpcode; | |
decoded += String.fromCharCode(tmpcode); | |
} else { | |
decoded += m; | |
} | |
} | |
return decoded; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gist Family:
#2931589 - All DanID/NemID string constants JSON file
#2931579 - DanID/NemID javascript string-deobfuscator
#2931595 - DanID/NemID constant lookup JSON file