Vbscript / General / Encode Hardcoded Passwords
This function encodes the characters in a password in order to prevent hardcoded passwords being displayed in clear text. It is a very basic method that can easily be reversed but provides a small barrier for the lazy intruder. Be aware that the password is encoded and not encrypted so can be decoded without too much effort. this method does not encode numeric values and an input character will always be encoded to the same output character.
strPassword = InputBox("Input Password","")
strHash = charRotate(strPassword)
wscript.Echo "Encoded: " & strHash
strPass = charRotate(strHash)
Wscript.Echo "Decoded: " & strPass
Function charRotate(strInput) strRotated = "" For i = 1 to Len(strInput) charA = Mid(strInput, i, 1) intA = Asc(charA) if intA >= 97 and intA =< 109 then intA = intA + 13 elseif intA >= 110 and intA =< 122 then intA = intA - 13 elseif intA >= 65 and intA =< 77 then intA = intA + 13 elseif intA >= 78 and intA =< 90 then intA = intA - 13 end if
strRotated = strRotated & Chr(intA)
Next
charRotate = strRotated
End Function
Please note that a disclaimer applies to any code on this page.
|