Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Encode Hardcoded Passwords
 

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.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
     - Exchange
     - Files And Folders
     - General
          - Check Remote Computer Disks
          - Encode Hardcoded Passwords
          - Generate Random Password
          - Get Machine Ip Address
          - Get Machine Ip Address From Name
          - Print All Files In A Folder
          - Run Chkdsk
          - Set All Network Adapters To Dhcp
          - Sql Server Query
          - Vbscript Logging Techniques
     - Ms Office
     - Operating System
     - Processes And Services
     - Text Processing
     - User Interaction
     - Web Servers