Sign in to follow this  
Followers 0
Nuffilein805

real nice encrypting method - hard to crack

37 posts in this topic

#1 ·  Posted (edited)

ok, me again

ok, again encrypting stuff

but, this time it's really nice and you can't decrypt it without the password

this method is mostly like vigniere, but there is 1 difference:

You can't set the Password! (well you can in this version)

The programm sets the password to the same lengths as the text you wish to be encrypted.

The password can be everything (all 256 chars).

There should be no way to decrypt you encrypted text without the password (at least it will take really long)

I've just got 1 problem. I don't know if there's a way to have 2 return-values, otherwise the prog has to write the pw to a textfile (or somewhere else, i don't care)

Anyway i post the code here, because i want your feedback!!!

Here's one example (can some1 decrypt this?):

ñM¾àlbE¢Í×â<ýþ®5åÊjE`MÍu£á

who can read it?

$text = "try this one out - put your text HERE"
$abc = perfect_vigniere($text, 0)
FileWrite ("tester25.txt", $text & "-" & $abc & @CRLF)
$code = FileReadLine ("tester25.txt", 1)
FileWrite ("tester25.txt", $abc & "-" & perfect_vigniere($abc, 1, $code) & @CRLF)

;if you want a save encryption don't use a password!

func perfect_vigniere($vigniere_text, $vigniere_encode, $vigniere_code = "")
if $vigniere_encode = 1 Then
            $vigniere_plain = $vigniere_text
            $vigniere_plain_letters = StringSplit ($vigniere_plain, "")
            $vigniere_plain_code = $vigniere_code
            $vigniere_code_letters = StringSplit ($vigniere_plain_code, "")
            $vigniere_max_code = $vigniere_code_letters[0] + 1
            dim $vigniere_convert[$vigniere_max_code]
            dim $vigniere_minus[$vigniere_max_code]
            for $vigniere_i = 1 to $vigniere_code_letters[0] step 1
                $vigniere_convert[$vigniere_i] = Asc ($vigniere_code_letters[$vigniere_i])
                $vigniere_minus[$vigniere_i] = $vigniere_convert[$vigniere_i] + 1
                if $vigniere_minus[$vigniere_i] > 255 Then
                    $vigniere_minus[$vigniere_i] = $vigniere_minus[$vigniere_i] - 256
                EndIf
            Next
            $vigniere_max_plain = $vigniere_plain_letters[0] + 1
            dim $vigniere_plain_convert[$vigniere_max_plain]
            dim $vigniere_output[$vigniere_max_plain]
            $vigniere_i = 0
            $vigniere = ""
            For $vigniere_j = 1 to $vigniere_plain_letters[0] step 1
                $vigniere_i = $vigniere_i + 1
                $vigniere_plain_convert[$vigniere_j] = Asc ($vigniere_plain_letters[$vigniere_j])
                if $vigniere_i > $vigniere_code_letters[0] Then
                    $vigniere_i = $vigniere_i - $vigniere_code_letters[0]
                EndIf
                $vigniere_test = $vigniere_plain_convert[$vigniere_j] - $vigniere_minus[$vigniere_i]
                if $vigniere_test < 0 Then
                    $vigniere_output[$vigniere_j] = $vigniere_plain_convert[$vigniere_j] + 256 - $vigniere_minus[$vigniere_i]
                EndIf
                $vigniere_output[$vigniere_j] = $vigniere_test
                $vigniere = $vigniere & chr($vigniere_output[$vigniere_j])
            Next
            return $vigniere
        ElseIf $vigniere_encode = 0 Then
            $vigniere_plain = $vigniere_text
            $vigniere_plain_letters = StringSplit ($vigniere_plain, "")
            if $vigniere_code = "" then
                $vigniere_max = $vigniere_plain_letters[0] + 1
                dim $vigniere_code_letters[$vigniere_max]
                for $vigniere_a = 1 to $vigniere_plain_letters[0] step 1
                    $vigniere_code_letters[$vigniere_a] = chr (random(0, 255, 1))
                    $vigniere_code = $vigniere_code & $vigniere_code_letters[$vigniere_a]
                Next
            $vigniere_plain_code = $vigniere_code
            $vigniere_code_letters = StringSplit ($vigniere_plain_code, "")
            $vigniere_max_code = $vigniere_code_letters[0] + 1
            dim $vigniere_convert[$vigniere_max_code]
            dim $vigniere_minus[$vigniere_max_code]
            for $vigniere_i = 1 to $vigniere_code_letters[0] step 1
                $vigniere_convert[$vigniere_i] = Asc ($vigniere_code_letters[$vigniere_i])
                $vigniere_minus[$vigniere_i] = $vigniere_convert[$vigniere_i] + 1
                if $vigniere_minus[$vigniere_i] > 255 Then
                    $vigniere_minus[$vigniere_i] = $vigniere_minus[$vigniere_i] - 256
                EndIf
            Next
            $vigniere_max_plain = $vigniere_plain_letters[0] + 1
            dim $vigniere_plain_convert[$vigniere_max_plain]
            dim $vigniere_output[$vigniere_max_plain]
            $vigniere_i = 0
            $vigniere = ""
            For $vigniere_j = 1 to $vigniere_plain_letters[0] step 1
                $vigniere_i = $vigniere_i + 1
                $vigniere_plain_convert[$vigniere_j] = Asc ($vigniere_plain_letters[$vigniere_j])
                if $vigniere_i > $vigniere_code_letters[0] Then
                    $vigniere_i = $vigniere_i - $vigniere_code_letters[0]
                EndIf
                $vigniere_test = $vigniere_plain_convert[$vigniere_j] + $vigniere_minus[$vigniere_i]
                if $vigniere_test > 255 Then
                    $vigniere_output[$vigniere_j] = $vigniere_plain_convert[$vigniere_j] - 256 + $vigniere_minus[$vigniere_i]
                EndIf
                $vigniere_output[$vigniere_j] = $vigniere_test
                $vigniere = $vigniere & chr($vigniere_output[$vigniere_j])
            Next
            FileWrite("tester25.txt", $vigniere_code & @CRLF)
            return $vigniere
        EndIf
    EndIf
EndFunc

please give me some feedback, if it worked, ...

updated the file: old 1 was downloaded 17 times

updated the file again: 10 downloads on the last 1

perfect_vigniere2.au3

Edited by Nuffilein805

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Isn't writing the password to a file defeating the whole purpose of encryption?

I'm failing to understand why you are devoting so much forum space to posting encryption algorithms all over the place that are so ineffective and weak.

Edited by Confuzzled

Share this post


Link to post
Share on other sites

Isn't writing the password to a file defeating the whole purpose of encryption?

I'm failing to understand why you are devoting so much forum space to posting encryption algorithms all over the place that are so ineffective and weak.

the old 1s may be weak (and were just for training) but this 1 isn't

the only reason why i write the pw to a file is because i haven't found a way to have 2 return values

thats the reason i asked

if you think this encryption is weak crack the code i posted, if you can you're all right if not ...

Share this post


Link to post
Share on other sites

the old 1s may be weak (and were just for training) but this 1 isn't

the only reason why i write the pw to a file is because i haven't found a way to have 2 return values

thats the reason i asked

if you think this encryption is weak crack the code i posted, if you can you're all right if not ...

You could use an array to have two return values


HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Cool!

Just tried it out and I got this.

ýа4¬+âðB/?r¼×,jºÎßö]ÕXÑj>µ·Õ£«]

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

Isn't writing the password to a file defeating the whole purpose of encryption?

Not really. Imagine writing an application which needs a username/password saved (because the user chooses to). Where would you save it? Certainly not as plain text in an INI file. And AutoIt's default encryption algorithms are weak.

Nuffilein's encryption algorithms are very useful in saving sensitive information. It would be very hard for a amateur to crack the passwords.

I'm failing to understand why you are devoting so much forum space to posting encryption algorithms all over the place that are so ineffective and weak.

Nuffilein's contributions are useful if you need them. So much functionality in AutoIt is possible only due to many users contribution for their domain. I am thinking about implementing his algorithms in my scripts, so they are useful to me B)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@Nuffilein805

I modified your function to return two values.

Function: _PerfectVigniere($vigniere_text, $vigniere_encode, $vigniere_code)

Return Value: Encrypted/Decrypted text.

Parameters:
$vigniere_text - Text string to encrypt/decrypt

$vigniere_encode - 0 or 1
0 - Encrypt
1 - Decrypt

$vigniere_code - Returns Decode Key when encoding
                         Provide decode key when decoding

Script:

Dim $sTexttoEncode, $sEncryptedText, $sDecryptedText
Dim $sDecodeKey

$sTexttoEncode = "try this one out - put your text HERE"

; Call the function with 0 in 2nd parameter to encode the text.
; The key to decode will be returned in 3rd parameter.
$sEncryptedText = _PerfectVigniere($sTexttoEncode, 0, $sDecodeKey)

; Call the function with 1 in the 2nd parameter to decode the text.
; Provide the decode key in the 3rd parameter
$sDecryptedText = _PerfectVigniere($sEncryptedText, 1, $sDecodeKey)

MsgBox(0, "Nuffilein805's Encryption Algorithm", "Original Text: " & $sTexttoEncode & @CRLF & _
        "Encrypted Text: " & $sEncryptedText & @CRLF & _
        "Decryped Text: " & $sDecryptedText & @CRLF & _
        "Decode Key: " & $sDecodeKey)


Func _PerfectVigniere($vigniere_text, $vigniere_encode, ByRef $vigniere_code)
    If $vigniere_encode = 1 Then
            $vigniere_plain = $vigniere_text
            $vigniere_plain_letters = StringSplit ($vigniere_plain, "")
            $vigniere_plain_code = $vigniere_code
            $vigniere_code_letters = StringSplit ($vigniere_plain_code, "")
            $vigniere_max_code = $vigniere_code_letters[0] + 1
            Dim $vigniere_convert[$vigniere_max_code]
            Dim $vigniere_minus[$vigniere_max_code]
            For $vigniere_i = 1 to $vigniere_code_letters[0] step 1
                $vigniere_convert[$vigniere_i] = Asc ($vigniere_code_letters[$vigniere_i])
                $vigniere_minus[$vigniere_i] = $vigniere_convert[$vigniere_i] + 1
                If $vigniere_minus[$vigniere_i] > 255 Then
                    $vigniere_minus[$vigniere_i] = $vigniere_minus[$vigniere_i] - 256
                EndIf
            Next
            $vigniere_max_plain = $vigniere_plain_letters[0] + 1
            Dim $vigniere_plain_convert[$vigniere_max_plain]
            Dim $vigniere_output[$vigniere_max_plain]
            $vigniere_i = 0
            $vigniere = ""
            For $vigniere_j = 1 to $vigniere_plain_letters[0] step 1
                $vigniere_i = $vigniere_i + 1
                $vigniere_plain_convert[$vigniere_j] = Asc ($vigniere_plain_letters[$vigniere_j])
                If $vigniere_i > $vigniere_code_letters[0] Then
                    $vigniere_i = $vigniere_i - $vigniere_code_letters[0]
                EndIf
                $vigniere_test = $vigniere_plain_convert[$vigniere_j] - $vigniere_minus[$vigniere_i]
                If $vigniere_test < 0 Then
                    $vigniere_output[$vigniere_j] = $vigniere_plain_convert[$vigniere_j] + 256 - $vigniere_minus[$vigniere_i]
                EndIf
                $vigniere_output[$vigniere_j] = $vigniere_test
                $vigniere = $vigniere & chr($vigniere_output[$vigniere_j])
            Next
            Return $vigniere
        ElseIf $vigniere_encode = 0 Then
            $vigniere_plain = $vigniere_text
            $vigniere_plain_letters = StringSplit ($vigniere_plain, "")
            If $vigniere_code = "" then
                $vigniere_max = $vigniere_plain_letters[0] + 1
                Dim $vigniere_code_letters[$vigniere_max]
                For $vigniere_a = 1 to $vigniere_plain_letters[0] step 1
                    $vigniere_code_letters[$vigniere_a] = Chr (random(0, 255, 1))
                    $vigniere_code = $vigniere_code & $vigniere_code_letters[$vigniere_a]
                Next
            $vigniere_plain_code = $vigniere_code
            $vigniere_code_letters = StringSplit ($vigniere_plain_code, "")
            $vigniere_max_code = $vigniere_code_letters[0] + 1
            Dim $vigniere_convert[$vigniere_max_code]
            Dim $vigniere_minus[$vigniere_max_code]
            For $vigniere_i = 1 to $vigniere_code_letters[0] step 1
                $vigniere_convert[$vigniere_i] = Asc ($vigniere_code_letters[$vigniere_i])
                $vigniere_minus[$vigniere_i] = $vigniere_convert[$vigniere_i] + 1
                If $vigniere_minus[$vigniere_i] > 255 Then
                    $vigniere_minus[$vigniere_i] = $vigniere_minus[$vigniere_i] - 256
                EndIf
            Next
            $vigniere_max_plain = $vigniere_plain_letters[0] + 1
            Dim $vigniere_plain_convert[$vigniere_max_plain]
            Dim $vigniere_output[$vigniere_max_plain]
            $vigniere_i = 0
            $vigniere = ""
            For $vigniere_j = 1 to $vigniere_plain_letters[0] step 1
                $vigniere_i = $vigniere_i + 1
                $vigniere_plain_convert[$vigniere_j] = Asc ($vigniere_plain_letters[$vigniere_j])
                If $vigniere_i > $vigniere_code_letters[0] Then
                    $vigniere_i = $vigniere_i - $vigniere_code_letters[0]
                EndIf
                $vigniere_test = $vigniere_plain_convert[$vigniere_j] + $vigniere_minus[$vigniere_i]
                If $vigniere_test > 255 Then
                    $vigniere_output[$vigniere_j] = $vigniere_plain_convert[$vigniere_j] - 256 + $vigniere_minus[$vigniere_i]
                EndIf
                $vigniere_output[$vigniere_j] = $vigniere_test
                $vigniere = $vigniere & Chr($vigniere_output[$vigniere_j])
            Next
            Return $vigniere
        EndIf
    EndIf
EndFunc

EDIT - I noticed that the encrypted text is not decrypted correctly everytime. It works correctly most of the time but sometimes it returns encrypted text does not get decrypted completely.

I managed to get one such case after about running the script 20 times.

Posted Image

I Hope you can fix this issue.

Regards,

Tonedeaf

Edited by tonedeaf

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

@wouter: but you can't find the random-key, so even if you know how its encrypted there's no way for you to find out the message

@all: i worked around this little prob with not the whole text decrypted and found a very clumsy solution, but it works - used tonedeaf's modified script cause this works a bit better and modified it myself (just 3 more lines of code)

updated the file in the first post

here is the new code:

Dim $sTexttoEncode, $sEncryptedText, $sDecryptedText
Dim $sDecodeKey

$sTexttoEncode = "try this one out - put your text HERE"

; Call the function with 0 in 2nd parameter to encode the text.
; The key to decode will be returned in 3rd parameter.
$sEncryptedText = _PerfectVigniere($sTexttoEncode, 0, $sDecodeKey)

; Call the function with 1 in the 2nd parameter to decode the text.
; Provide the decode key in the 3rd parameter
$sDecryptedText = _PerfectVigniere($sEncryptedText, 1, $sDecodeKey)

MsgBox(0, "Nuffilein805's Encryption Algorithm", "Original Text: " & $sTexttoEncode & @CRLF & _
        "Encrypted Text: " & $sEncryptedText & @CRLF & _
        "Decryped Text: " & $sDecryptedText & @CRLF & _
        "Decode Key: " & $sDecodeKey)


Func _PerfectVigniere($vigniere_text, $vigniere_encode, ByRef $vigniere_code)
    If $vigniere_encode = 1 Then
        
            $vigniere_plain = $vigniere_text
            $vigniere_plain_letters = StringSplit ($vigniere_plain, "")
            $vigniere_plain_code = $vigniere_code
            $vigniere_code_letters = StringSplit ($vigniere_plain_code, "")
            $vigniere_max_code = $vigniere_code_letters[0] + 1
            Dim $vigniere_convert[$vigniere_max_code]
            Dim $vigniere_minus[$vigniere_max_code]
            For $vigniere_i = 1 to $vigniere_code_letters[0] step 1
                $vigniere_convert[$vigniere_i] = Asc ($vigniere_code_letters[$vigniere_i])
                $vigniere_minus[$vigniere_i] = $vigniere_convert[$vigniere_i] + 1
                If $vigniere_minus[$vigniere_i] > 255 Then
                    $vigniere_minus[$vigniere_i] = $vigniere_minus[$vigniere_i] - 256
                EndIf
            Next
            $vigniere_max_plain = $vigniere_plain_letters[0] + 1
            Dim $vigniere_plain_convert[$vigniere_max_plain]
            Dim $vigniere_output[$vigniere_max_plain]
            $vigniere_i = 0
            $vigniere = ""
            For $vigniere_j = 1 to $vigniere_plain_letters[0] step 1
                $vigniere_i = $vigniere_i + 1
                $vigniere_plain_convert[$vigniere_j] = Asc ($vigniere_plain_letters[$vigniere_j])
                If $vigniere_i > $vigniere_code_letters[0] Then
                    $vigniere_i = $vigniere_i - $vigniere_code_letters[0]
                EndIf
                $vigniere_test = $vigniere_plain_convert[$vigniere_j] - $vigniere_minus[$vigniere_i]
                If $vigniere_test < 0 Then
                    $vigniere_output[$vigniere_j] = $vigniere_plain_convert[$vigniere_j] + 256 - $vigniere_minus[$vigniere_i]
                EndIf
                $vigniere_output[$vigniere_j] = $vigniere_test
                $vigniere = $vigniere & chr($vigniere_output[$vigniere_j])
            Next
    
            Return $vigniere
        ElseIf $vigniere_encode = 0 Then
            
            $vigniere_plain = $vigniere_text
            $vigniere_plain_letters = StringSplit ($vigniere_plain, "")
            If $vigniere_code = "" then
                Do
                $vigniere_max = $vigniere_plain_letters[0] + 1
                Dim $vigniere_code_letters[$vigniere_max]
                For $vigniere_a = 1 to $vigniere_plain_letters[0] step 1
                    $vigniere_code_letters[$vigniere_a] = Chr (random(0, 255, 1))
                    $vigniere_code = $vigniere_code & $vigniere_code_letters[$vigniere_a]
                Next
            $vigniere_plain_code = $vigniere_code
            $vigniere_code_letters = StringSplit ($vigniere_plain_code, "")
            $vigniere_max_code = $vigniere_code_letters[0] + 1
            Dim $vigniere_convert[$vigniere_max_code]
            Dim $vigniere_minus[$vigniere_max_code]
            For $vigniere_i = 1 to $vigniere_code_letters[0] step 1
                $vigniere_convert[$vigniere_i] = Asc ($vigniere_code_letters[$vigniere_i])
                $vigniere_minus[$vigniere_i] = $vigniere_convert[$vigniere_i] + 1
                If $vigniere_minus[$vigniere_i] > 255 Then
                    $vigniere_minus[$vigniere_i] = $vigniere_minus[$vigniere_i] - 256
                EndIf
            Next
            $vigniere_max_plain = $vigniere_plain_letters[0] + 1
            Dim $vigniere_plain_convert[$vigniere_max_plain]
            Dim $vigniere_output[$vigniere_max_plain]
            $vigniere_i = 0
            $vigniere = ""
            For $vigniere_j = 1 to $vigniere_plain_letters[0] step 1
                $vigniere_i = $vigniere_i + 1
                $vigniere_plain_convert[$vigniere_j] = Asc ($vigniere_plain_letters[$vigniere_j])
                If $vigniere_i > $vigniere_code_letters[0] Then
                    $vigniere_i = $vigniere_i - $vigniere_code_letters[0]
                EndIf
                $vigniere_test = $vigniere_plain_convert[$vigniere_j] + $vigniere_minus[$vigniere_i]
                If $vigniere_test > 255 Then
                    $vigniere_output[$vigniere_j] = $vigniere_plain_convert[$vigniere_j] - 256 + $vigniere_minus[$vigniere_i]
                EndIf
                $vigniere_output[$vigniere_j] = $vigniere_test
                $vigniere = $vigniere & Chr($vigniere_output[$vigniere_j])
            Next
            $sDecryptedText = _PerfectVigniere($vigniere, 1, $vigniere_code)
            until $sDecryptedText = $vigniere_text
            Return $vigniere
        EndIf
    EndIf
EndFunc
Edited by Nuffilein805

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

it could be bruteforced ...

A lot of things can. Edited by layer

FootbaG

Share this post


Link to post
Share on other sites

Everything will succumb to a brute force attack, however it may take time for a advanced aglorithim and a key with 100 charaters.

Lol, just think how long a brute force would take with a really long key:

A...

B

C...

AA...

BB

CC...

........

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

evrything can be bruteforced. but like lonewolf sayd it takes a long time.

and i still dont get the use of this ?

care to give an example of how this could be actually usefull in a "real" situation.

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites

<snipped>

EDIT - I noticed that the encrypted text is not decrypted correctly everytime. It works correctly most of the time but sometimes it returns encrypted text does not get decrypted completely.

I managed to get one such case after about running the script 20 times.

Posted Image

I Hope you can fix this issue.

Regards,

Tonedeaf

I've noticed that a lot in Virgenere-based encryption systems. I once encrypted a block of text and ended up where only one line could be decrypted at a time. Though a blank line determined which line would be decrypted, I would be interested to find out if this is inherent in Virgenere or just an anomaly that just happens.


Share this post


Link to post
Share on other sites

i think thats an anomaly that happens when you use all 256 chars, cause sometimes you will get a pw with e.g. a crlf or a cr in it, this will make the decryption make mistakes

@wouter: lets say you write an e-mail message to your boss and you don't want anyone to read it, ecrypt it this way and you can be sure noone can read it

you can send your boss the key on another way, or even in the mail - maybe invert the key using my atbash-encryption, noone will be able to read it

2nd: a 1-time-pad is not crackable as you can read on wikipedia, you get unlimited possibly texts out of 1 encrypted text, cause you don't know the key

if you hit the right key by being lucky you won't know if its the right key

e.g. (easy way)

real-text: this is my text

encrypted text: uioplkjhgfdsaq

decrypted text1: this is no text

decrypted text2: this is my test

...

you see there are unlimited possiblilites to just decode this little text, how can you say its the right 1 you decrypted?

Share this post


Link to post
Share on other sites

@Nuffilein805

The script now hangs instead of giving the wrong ouput. ;-)

Share this post


Link to post
Share on other sites

@Nuffilein805

The script now hangs instead of giving the wrong ouput. ;-)

Which of the two alternatives is preferable? B)

Share this post


Link to post
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
Sign in to follow this  
Followers 0