Skip to content

Commit

Permalink
Changed encryption method from AES to OTP.
Browse files Browse the repository at this point in the history
  • Loading branch information
DetroitApps committed Nov 4, 2019
1 parent b49136d commit f43738e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 102 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ The content of this repository is bound by the following license(s):
- The computer software Retro Multi Manager and its associated source code is licensed under the [GNU General Public License v3.0](https://github.com/DetroitApps/RetroMultiManager/blob/master/LICENSE) license.
- The license doesn't apply for Library files
- [SB_SetProgress]( https://autohotkey.com/board/topic/34593-stdlib-sb-setprogress/ ) by derRaphael ([EUPL v1.0](https://spdx.org/licenses/EUPL-1.0.html))
- [AES](https://gist.github.com/jNizM/79aa6a4b8ec428bf780f) by [jNizM]( https://gist.github.com/jNizM )
- [i18n-autohotkey](https://github.com/iammael/i18n-autohotkey) by [IAmMael](https://github.com/iammael/) ([MIT](https://github.com/iammael/i18n-autohotkey/blob/master/LICENSE))
- Icon made by [monkik](https://www.flaticon.com/authors/monkik) from [www.flaticon.com](http://www.flaticon.com/)

2 changes: 1 addition & 1 deletion app.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CoordMode, Mouse, Window
#Include src\class\accounts.ahk
#Include src\class\logger.ahk
#Include src\class\settings.ahk
#Include src\lib\AES.ahk
#Include src\lib\OTP.ahk
#Include src\lib\i18n.ahk

;----------------------------------------
Expand Down
14 changes: 6 additions & 8 deletions src/labels/labels.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ LoadProfile:
break
If (Encrypt = 1)
{
username := AES.Decrypt(username, MasterPassword, 256)
;msgbox, %username%
username := RegExReplace(username, "[^[:ascii:]]") ;clean weird characters when decoding
password := AES.Decrypt(password, MasterPassword, 256)
password := RegExReplace(password, "[^[:ascii:]]")
username := XOR_String_Minus(username, MasterPassword)
password := XOR_String_Minus(password, MasterPassword)
}
ArrayAccounts[A_Index] := New Account(username, password, nickname, characterClass, isActive, playerSlot, serverSlot)
If Settings.GuiStatus
Expand All @@ -83,7 +80,7 @@ LoadProfile:
SaveProfile:
FileCreateDir, Profiles
profileIniPath := A_WorkingDir . "\Profiles\profile" . SelectProfile . ".ini"
file := FileOpen(profileIniPath, "w")
file := FileOpen(profileIniPath, "w", "UTF-16")
If (file = 0)
{
MsgBox,, % Translate("Error"), % "[" A_LastError "]" Translate("ErrorSaveProfile", profileIniPath) "."
Expand All @@ -96,11 +93,12 @@ SaveProfile:

username := InputUsername%A_Index%
If (CheckEncryption = 1)
username := AES.Encrypt(username, MasterPassword, 256)
username := XOR_String_Plus(username, MasterPassword)
file.WriteLine("Username" . A_Index . "=" . username)
password := InputPassword%A_Index%
If (CheckEncryption = 1)
password := AES.Encrypt(password, MasterPassword, 256)
password := XOR_String_Plus(password, MasterPassword)
Logger.Write(username)
file.WriteLine("Password" . A_Index . "=" . password)
file.WriteLine("Nickname" . A_Index . "=" . InputNickname%A_Index%)
file.WriteLine("Class" . A_Index . "=" . SelectClass%A_Index%)
Expand Down
92 changes: 0 additions & 92 deletions src/lib/AES.ahk

This file was deleted.

25 changes: 25 additions & 0 deletions src/lib/OTP.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
XOR_String_Plus(String,Key)
{
Key_Pos := 1
Loop, Parse, String
{
String_XOR .= Chr((Asc(A_LoopField) ^ Asc(SubStr(Key,Key_Pos,1))) + 15000)
Key_Pos += 1
if (Key_Pos > StrLen(Key))
Key_Pos := 1
}
return String_XOR
}

XOR_String_Minus(String,Key)
{
Key_Pos := 1
Loop, Parse, String
{
String_XOR .= Chr(((Asc(A_LoopField) - 15000) ^ Asc(SubStr(Key,Key_Pos,1))))
Key_Pos += 1
if (Key_Pos > StrLen(Key))
Key_Pos := 1
}
return String_XOR
}

0 comments on commit f43738e

Please sign in to comment.