Simple Text Encrypting to prevent having your passwords stored as plain text

In one of my videos on what I’ve automated lately, I demonstrated the little tool I wrote to encode / decode text (typically passwords). Someone asked if I could share the code so I’m doing that here. In case you missed the video, I created a shorter one just on this topic below.

Text Encrypting Code

#SingleInstance, Force
Constant:="90" ;Change this to a number you want
;********************What do you want to Encode?***********************************
InputBox, Pass, Encode,What do you wish to encode?,,600,130
Clipboard:=Encoded:=Encrypt(Pass,Constant)
InputBox, PlaceHolder,   Encoded Value, % "Here is the encoded value", ,600,130,,,,,%Encoded%
;********************Now show taking it the other way***********************************
MsgBox % "Here is the Decoded value: " Decrypt(Encoded,Constant)
return

Encrypt(OutputVar,Constant){
  Loop, Parse, OutputVar
  \
    GuiControl,, Char, %A_LoopField%
    Transform, OutputVar, Asc, %A_LoopField%
    Outputvar-=Constant, NewVar.=OutputVar . "a"
  }Return, NewVar
}

Decrypt(OutputVar,Constant){
  Loop, Parse, OutputVar, a 
    Decrypted.= (Chr(A_LoopField+Constant))
  return, Decrypted
}

Simple Text Encrypting to prevent having your passwords stored as plain text

 

 

Comments are closed.