Jump to content

How do you remove characters every X amount of characters?


Opie
 Share

Recommended Posts

Well basically, i made a generic masking type encryption in VB6 and its pretty random. I can only think of one way to remove the mask and show the decrypted text.

The encryption is based on Pseudo Alpha Numeric Generation with modification to include most common ASCII characters. The decrypted text is turned into capitals to prevent easier decryption. Obviously a few lowercase among all uppercase is well; Obvious.

An example of the encryption is

1C00FT?@7107E19543;2@2368744EG?1E58;8B@;:;988=77<7>SDAI3@1AA01D5I@4D2211D6TC217F29663;6A33E37>780I=6320231FE8377H15D18H8N7A7988582B1HC9@9G708I6G;0683485B<19>0?63B49;1 13H52387D75F0413A:;H48T25I1=42871F2D308@H8<28E346=7?>5H3?2@590CC28B0S?08D4451F=6EE9807<9860TA60373969?7@>31120E5@8ID12320;93@10=569<:23I4N640I95:G0513B4A588?0A@G01C5H?3D26>574777=?870 :220:82?15465G;40381IGLCB721@7H2763:2D32@2245E99:205G610C@B91C9DF930T4I=E0501668F91928;<:00S05<17;4596B?B1387B00E; FA4696@<2647?4;<5509F8S6B9:98891C68A9?0FI@?C7E06F0I44241A08C997B8H=4EH1F13I7C8228H10859<761 88:77741A42:0;220=50H;H?C7960514D0431<?2@07<8O9B6A429EE94B?82910:82?W354A59;404H109D7C;38I3 7<D>64934155F973E70393EGB43;0F;BC89803H<F1521N@@9831I2G312C7B63F0138CA:4382<G3>98@2A<77H720RE8D:2D0014A5<;875I5;FGY@883653>490936:12D7971P7I481511=@28<1G3D0HD5?TA1H6C0843631>06C2E22I6E5H6959DB>=51H4?CBI8071D<F1522>A3251H3E41B<848 F4=C6G30398D0=01:=1779HFIC0F7@5?305A891<A7@14I?1@@0295H7>C;D7=?21@TF990=432694657CD4>0869H>EEC43:9E4@DD9202D7@H9IEI372A1H7969GB4=4<7824S6=7?>5G3?265I0B4H62:0; 72FE0>29025:B<749?G8HHI7:066GAG5986;<>081C984S:631>06C216691?808G353 HG9;38041864@5E5<=3356;60;2867110DAC227F6348<(@:8249=6G263E54>=9732)2@5048<AIC7645@67

the decrypted text in the above example is

testing testing lets see how encrypted this is :)

The mask generates code around the decrypted text like this VV

RandomGen(Number of characters to produce) ;===> This is the function and the parameters, so you know what im talking about

strD ;===> This is the variable that stores the decrypted text.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This actual string of code for the generation is like this.

RandomGen(10) & UCase(strD + RandomString(8)) & RandomGen(10)

What i want to do is use autoit3 as a decryptor and extract the decrypted text by erasing the randomly generated code. So Delete 10, skip one, delete 8, skip 1, delete 10, skip one...and so on and so forth. Im sure you guys understand right?

Im not gonna lie, i suck horribly at string management in AU3. Which is why i am asking for help. I would love any kind of help and credits would be to you in the decrypter when made.

Thanks much!

-Jacob

Edited by Opie
Link to comment
Share on other sites

I don't know of a good way to loop this to make it less code, but this kind of what you want:

#include <array.au3>
Dim $array[5]
$text = "1234567890A12345678B1234567890C12345678D1234567890E"

$text = StringTrimLeft($text, 10)
$array[0] = StringLeft($text, 1) ; character A
$text = StringTrimLeft ($text, 1) ; trim the character
$text = StringTrimLeft ($text, 8) ; trim the next random number - could be combined with last statement into one
$array[1] = StringLeft($text, 1) ; Character B
$text = StringTrimLeft ($text, 11) ; trim character and 10 random numbers
$array[2] = StringLeft($text, 1) ; Character C
$text = StringTrimLeft ($text, 9) ; trim character and 8 random numbers
$array[3] = StringLeft($text, 1) ; Character D
$text = StringTrimLeft ($text, 11) ; trim character and 8 random numbers
$array[4] = StringLeft($text, 1) ; Character E
$text = StringTrimLeft ($text, 9) ; trim character and 8 random numbers

_ArrayDisplay($array)

$string = _ArrayToString($array, "")
MsgBox(0, "", "Your string is: " & $string)
Edited by sleepydvdr

#include <ByteMe.au3>

Link to comment
Share on other sites

I don't know of a good way to loop this to make it less code, but this kind of what you want:

#include <array.au3>
Dim $array[5]
$text = "1234567890A12345678B1234567890C12345678D1234567890E"

$text = StringTrimLeft($text, 10)
$array[0] = StringLeft($text, 1) ; character A
$text = StringTrimLeft ($text, 1) ; trim the character
$text = StringTrimLeft ($text, 8) ; trim the next random number - could be combined with last statement into one
$array[1] = StringLeft($text, 1) ; Character B
$text = StringTrimLeft ($text, 11) ; trim character and 10 random numbers
$array[2] = StringLeft($text, 1) ; Character C
$text = StringTrimLeft ($text, 9) ; trim character and 8 random numbers
$array[3] = StringLeft($text, 1) ; Character C
$text = StringTrimLeft ($text, 11) ; trim character and 8 random numbers
$array[4] = StringLeft($text, 1) ; Character C
$text = StringTrimLeft ($text, 9) ; trim character and 8 random numbers

_ArrayDisplay($array)

$string = _ArrayToString($array, "")
MsgBox(0, "", "Your string is: " & $string)

Thanks ill try this out! :)

Darn, it didnt work ;)(

Sorry man.

also, editing in what the decrypted text is.

Edited by Opie
Link to comment
Share on other sites

  • Moderators

Opie,

I take it you realise your idea is almost worthless as an encrytion scheme. ;)

But this script will extract the characters from the string as you requested: :)

; The original text = ABCDE
;                   A        B          C        D          E
$sText = "1234567890A87654321B1234567890C87654321D1234567890E87654321"

; Set initial conditions
$iCount = 0
$iLen = StringLen($sText)
$sClearText = ""

Do
    ; Jump over the char we have just read and the random generated 10
    $iCount += 11
    ; Read the character
    $sClearText &= StringMid($sText, $iCount, 1)
    ; Check there are enough characters left
    If $iLen - $iCount + 1 < 8 Then ExitLoop
    ; Skip over the cher we have just read and the random string 8
    $iCount += 9
    ; Read the character
    $sClearText &= StringMid($sText, $iCount, 1)

; Check there are enough characters left
Until $iLen - $iCount + 1 < 10

; Display the extracted character
ConsoleWrite($sClearText & @CRLF)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Opie,

I take it you realise your idea is almost worthless as an encrytion scheme. :D

But this script will extract the characters from the string as you requested: :)

; The original text = ABCDE
;                  A        B         C     D         E
$sText = "1234567890A87654321B1234567890C87654321D1234567890E87654321"

; Set initial conditions
$iCount = 0
$iLen = StringLen($sText)
$sClearText = ""

Do
    ; Jump over the char we have just read and the random generated 10
    $iCount += 11
    ; Read the character
    $sClearText &= StringMid($sText, $iCount, 1)
    ; Check there are enough characters left
    If $iLen - $iCount + 1 < 8 Then ExitLoop
    ; Skip over the cher we have just read and the random string 8
    $iCount += 9
    ; Read the character
    $sClearText &= StringMid($sText, $iCount, 1)

; Check there are enough characters left
Until $iLen - $iCount + 1 < 10

; Display the extracted character
ConsoleWrite($sClearText & @CRLF)

M23

i kinda realize that but members of a forum im active on requested a real-time key crypter. Not sure why o.0 So i just decided to mask and pretend its real encryption xD

Thank you, ill try it ;)

edit: it didnt work either D:

the outcome in the console was

02?;>A1FE678B08650212>CD8A@@3:5AC5 11@2:9T8<486?6CC4B108:H4@2241 430<97C970566I2?425CFH891@1@;96HE@A470 58G8>1G66134>55

Edited by Opie
Link to comment
Share on other sites

  • Moderators

Opie,

It didi not work because what you have just posted as encrypted text is nothing like what you described in the text. And the current scheme is even less secure than the one you described. :)

And much easier to crack - although I think you have a problem in the encryption code as it does not read correctly at the end: ;)

$sText = "1C00FT?@7107E19543;2@2368744EG?1E58;8B@;:;988=77<7>SDAI3@1AA01D5I@4D2211D6TC217F29663;6A33E37>780I=6320231FE8377H15D18H8N7A7988582B1HC9" & _
         "@9G708I6G;0683485B<19>0?63B49;1 13H52387D75F0413A:;H48T25I1=42871F2D308@H8<28E346=7?>5H3?2@590CC28B0S?08D4451F=6EE9807<9860TA60373969?7" & _
         "@>31120E5@8ID12320;93@10=569<:23I4N640I95:G0513B4A588?0A@G01C5H?3D26>574777=?870 :220:82?15465G;40381IGLCB721@7H2763:2D32@2245E99:205G6" & _
         "10C@B91C9DF930T4I=E0501668F91928;<:00S05<17;4596B?B1387B00E; FA4696@<2647?4;<5509F8S6B9:98891C68A9?0FI@?C7E06F0I44241A08C997B8H=4EH1F13" & _
         "I7C8228H10859<761 88:77741A42:0;220=50H;H?C7960514D0431<?2@07<8O9B6A429EE94B?82910:82?W354A59;404H109D7C;38I3 7<D>64934155F973E70393EGB" & _
         "43;0F;BC89803H<F1521N@@9831I2G312C7B63F0138CA:4382<G3>98@2A<77H720RE8D:2D0014A5<;875I5;FGY@883653>490936:12D7971P7I481511=@28<1G3D0HD5?" & _
         "TA1H6C0843631>06C2E22I6E5H6959DB>=51H4?CBI8071D<F1522>A3251H3E41B<848 F4=C6G30398D0=01:=1779HFIC0F7@5?305A891<A7@14I?1@@0295H7>C;D7=?21" & _
         "@TF990=432694657CD4>0869H>EEC43:9E4@DD9202D7@H9IEI372A1H7969GB4=4<7824S6=7?>5G3?265I0B4H62:0; 72FE0>29025:B<749?G8HHI7:066GAG5986;<>081" & _
         "C984S:631>06C216691?808G353 HG9;38041864@5E5<=3356;60;2867110DAC227F6348<(@:8249=6G263E54>=9732)2@5048<AIC7645@67"

$iLen = StringLen($sText)
$sClearText = ""

For $i = 6 To $iLen Step 23
    $sClearText &= StringMid($sText, $i, 1)
Next

ConsoleWrite($sClearText & @CRLF)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Opie,

It didi not work because what you have just posted as encrypted text is nothing like what you described in the text. And the current scheme is even less secure than the one you described. :)

And much easier to crack - although I think you have a problem in the encryption code as it does not read correctly at the end: ;)

$sText = "1C00FT?@7107E19543;2@2368744EG?1E58;8B@;:;988=77<7>SDAI3@1AA01D5I@4D2211D6TC217F29663;6A33E37>780I=6320231FE8377H15D18H8N7A7988582B1HC9" & _
         "@9G708I6G;0683485B<19>0?63B49;1 13H52387D75F0413A:;H48T25I1=42871F2D308@H8<28E346=7?>5H3?2@590CC28B0S?08D4451F=6EE9807<9860TA60373969?7" & _
         "@>31120E5@8ID12320;93@10=569<:23I4N640I95:G0513B4A588?0A@G01C5H?3D26>574777=?870 :220:82?15465G;40381IGLCB721@7H2763:2D32@2245E99:205G6" & _
         "10C@B91C9DF930T4I=E0501668F91928;<:00S05<17;4596B?B1387B00E; FA4696@<2647?4;<5509F8S6B9:98891C68A9?0FI@?C7E06F0I44241A08C997B8H=4EH1F13" & _
         "I7C8228H10859<761 88:77741A42:0;220=50H;H?C7960514D0431<?2@07<8O9B6A429EE94B?82910:82?W354A59;404H109D7C;38I3 7<D>64934155F973E70393EGB" & _
         "43;0F;BC89803H<F1521N@@9831I2G312C7B63F0138CA:4382<G3>98@2A<77H720RE8D:2D0014A5<;875I5;FGY@883653>490936:12D7971P7I481511=@28<1G3D0HD5?" & _
         "TA1H6C0843631>06C2E22I6E5H6959DB>=51H4?CBI8071D<F1522>A3251H3E41B<848 F4=C6G30398D0=01:=1779HFIC0F7@5?305A891<A7@14I?1@@0295H7>C;D7=?21" & _
         "@TF990=432694657CD4>0869H>EEC43:9E4@DD9202D7@H9IEI372A1H7969GB4=4<7824S6=7?>5G3?265I0B4H62:0; 72FE0>29025:B<749?G8HHI7:066GAG5986;<>081" & _
         "C984S:631>06C216691?808G353 HG9;38041864@5E5<=3356;60;2867110DAC227F6348<(@:8249=6G263E54>=9732)2@5048<AIC7645@67"

$iLen = StringLen($sText)
$sClearText = ""

For $i = 6 To $iLen Step 23
    $sClearText &= StringMid($sText, $i, 1)
Next

ConsoleWrite($sClearText & @CRLF)

M23

I noticed i pasted the wrong encrypted text into the OP, my apologies.

I was running through different variations and C/P'd the wrong one.

This example works, just shows a little jibberish at the end. thanks much!

note: idc much about the security. its just a simple vb6 key mask.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...