A new very unusual text crypter is ready.
It solves the problem to encrypt and decrypt text parts or even the whole text in emails or documents.
An encrypted text line at the end of an email looks more like a transmission error or something, but not like an encrypted text.
So it is possible to transfer important information unobtrusively or to make whole documents unreadable.
This crypter is something completely new, so no one will know such a thing.
The generated passwords can be very small, because they have a very high complexity.
They correspond to more than four times the length of common passwords.
The Crypter works AES based and is blazing fast.
It can also encrypt any number of times, Encrypter and Decrypter have the same effect.
This means that a plaintext file can be encrypted with a decryption step and decrypted with a encryption step.
It is a very small module, which can also be easily hidden, or embedded in other software unnoticed.
Code: Select all
; ######## Magic Clipboard Text Crypter QAES ########
DeclareModule MagicClipboard_TextCrypter_QAES
EnableExplicit
UseMD5Fingerprint()
Declare MagicClipboard_TextCrypter_QAES() ; A complete Clipboard based text crypter
EndDeclareModule
Module MagicClipboard_TextCrypter_QAES
Procedure.s Obfuscator_QAES(string$, mode, password$="", strongness=4, shift=200)
; Obfuscator / TextCrypter - AES enhanced - x86/64 - Unicode - This code is free for changing and enhancing
; No warranty whats ever - Using on your own risk
; mode=0 - encode // mode=1 - decode
; shift - Shift to visible encrypted characters - Mostly you must not change the preset
; strongness - 3 > 6 - preset=4 - This is the AES based randomized max shift - 3=31 - 4=63 - 5=127 - 6=255
Dim register.q(1)
If SizeOf(character)=1 : ProcedureReturn "Created for Unicode" : EndIf
If string$="" : ProcedureReturn "" : EndIf
If strongness<3 : strongness=3 : EndIf : If strongness>6 : strongness=6 : EndIf
Protected string_length=StringByteLength(string$)-2 : strongness=6-strongness
Protected i, ii, iii, depth, *pos_w.word, fixed$=StringFingerprint(password$+"%$(s4DäÖ", #PB_Cipher_MD5)
Repeat: PokeA(@register(0)+i, Val("$"+PeekS(@fixed$+ii, 2))) : ii+SizeOf(character) : Until ii=Len(fixed$)
Repeat
Repeat
If Not iii : AESDecoder(@register(0), @register(0), 16, @register(0), 128, 0, #PB_Cipher_ECB) : EndIf
depth=PeekA(@register(0)+iii)>>strongness : iii+1 : If iii>15 : iii=0 : EndIf
Until depth
depth=depth+shift : *pos_w=@string$+i
If *pos_w\w<>10 And *pos_w\w<>13 : If mode : *pos_w\w-depth : Else : *pos_w\w+depth : EndIf : EndIf
i+2 : *pos_w+2
Until i>string_length
ProcedureReturn string$
EndProcedure
Procedure MagicClipboard_TextCrypter_QAES()
Protected path$
Protected home_pos$=GetHomeDirectory()+"Sakis_ClipBoardCrypter_pos_QAES"
Protected home_pas$=GetHomeDirectory()+"Sakis_ClipBoardCrypter_pas_QAES"
If FileSize(home_pos$)>0
Protected file=ReadFile(#PB_Any, home_pos$)
Protected window_x=ReadLong(file)
Protected window_y=ReadLong(file)
CloseFile(file)
Protected flags=#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_Invisible
Else
flags=#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_Invisible
EndIf
If FileSize(home_pas$)>0
file=ReadFile(#PB_Any, home_pas$)
Protected password$=ReadString(file)
CloseFile(file)
EndIf
Protected window_title$="Clipboard Text Crypter"
Protected window_ID=OpenWindow(#PB_Any, window_x, window_y, 400, 260, window_title$, flags)
SetWindowColor(window_ID, $808080)
Protected menu=CreateMenu(#PB_Any, WindowID (window_ID))
If menu
MenuTitle("Menu")
MenuItem(1, "Delete the Clipboard content")
MenuBar()
MenuItem(2, "Change the Password")
MenuItem(3, "Load a Password")
MenuItem(4, "Save a Password")
MenuItem(5, "Create and use a Password in your UserDirectory")
MenuItem(6, "Delete the Password sure in your UserDirectory")
MenuBar()
MenuItem(7, "Info")
EndIf
Macro write_pos
window_x=WindowX(window_ID) : window_y=WindowY(window_ID)
file=CreateFile(#PB_Any, home_pos$)
If file
WriteLong(file, window_x)
WriteLong(file, window_y)
CloseFile(file) : EndIf
EndMacro
Macro write_pas
file=CreateFile(#PB_Any, home_pas$)
If file
WriteString(file, password$, #PB_UTF8)
CloseFile(file) : EndIf
EndMacro
Macro save_pas
path$=SaveFileRequester("Save a password", "", "", 0)
If path$<>""
file=CreateFile(#PB_Any, path$)
If file
WriteString(file, password$, #PB_UTF8)
CloseFile(file) : EndIf
EndIf
EndMacro
If password$=""
password$=InputRequester("", "Set a passord", "")
If password$="" : End : EndIf
password$=Obfuscator_QAES(password$, 0, password$, 6)
EndIf
Protected i, ii, random.a, win_event, result$, password_1$
Protected text_gadget_ID=TextGadget(#PB_Any, 20, 20, 360, 160, "", #PB_Text_Border)
Protected button_encrypt_ID=ButtonGadget(#PB_Any, 20, 195, 80, 30, "Encrypt")
Protected button_get_clipboard_ID=ButtonGadget(#PB_Any, 140, 195, 120, 30, "Get Clipboard")
Protected button_decrypt_ID=ButtonGadget(#PB_Any, 300, 195, 80, 30, "Decrypt")
SetWindowTitle(window_ID, window_title$+" : "+Left(UCase(StringFingerprint(password$, #PB_Cipher_MD5)),6 ))
SetGadgetText(text_gadget_ID, Left(GetClipboardText(), 1000))
HideWindow(window_ID, 0)
Repeat
win_event=WaitWindowEvent()
If win_event=#PB_Event_Menu
Select EventMenu()
Case 1
SetClipboardText("")
SetGadgetText(text_gadget_ID, "")
Case 2
password_1$=InputRequester("", "Set your new passord", "")
If password_1$<>""
password$=password_1$
password$=Obfuscator_QAES(password$, 0, password$, 6)
SetWindowTitle(window_ID, window_title$+" : "+Left(UCase(StringFingerprint(password$, #PB_Cipher_MD5)),6 ))
password_1$=#Null$
EndIf
Case 3
path$=OpenFileRequester("Load a Password", "", "", 0)
If path$<>""
file=ReadFile(#PB_Any, path$)
If file
password_1$=ReadString(file)
If password_1$<>""
password$=password_1$
SetWindowTitle(window_ID, window_title$+" : "+Left(UCase(StringFingerprint(password$, #PB_Cipher_MD5)),6 ))
password_1$=#Null$
EndIf
EndIf
EndIf
Case 4
save_pas
Case 5
write_pas
Case 6
window_x=WindowX(window_ID) : window_y=WindowY(window_ID)
file=OpenFile(#PB_Any, home_pas$)
If file
For i=1 To 5
FileSeek(file, 0)
For ii=0 To Lof(file)-1
random=Random($FF)
WriteData(file, @random, 1)
Next
Next
CloseFile(file)
DeleteFile(home_pas$)
EndIf
Case 7
MessageRequester("Saki's "+window_title$+" QAES ", "Free for use and free distribution"+#LF$+
"The settings and password file is in your home folder"+#LF$+
"In the window title bar you will see a hint to the used key"+#LF$+#LF$+
"Using on your own risk - No Warranty whats ever")
EndSelect
EndIf
If win_event=#PB_Event_Gadget
Select EventGadget()
Case button_encrypt_ID
result$=GetClipboardText()
result$=Obfuscator_QAES(result$, 0, password$, 6)
SetGadgetText(text_gadget_ID, Left(result$, 1000))
SetClipboardText(result$)
Case button_get_clipboard_ID
result$=GetClipboardText()
SetGadgetText(text_gadget_ID, Left(result$, 1000))
SetClipboardText(result$)
Case button_decrypt_ID
result$=GetClipboardText()
result$=Obfuscator_QAES(result$, 1, password$, 6)
SetGadgetText(text_gadget_ID, Left(result$, 1000))
SetClipboardText(result$)
EndSelect
EndIf
If win_event=#PB_Event_CloseWindow
write_pos
End
EndIf
ForEver
EndProcedure
EndModule
UseModule MagicClipboard_TextCrypter_QAES
; ###### Get the result ######
EnableExplicit
MagicClipboard_TextCrypter_QAES()