Sign in to follow this  
Followers 0
Aktonius

Why is encrypted string(_StringEncrypt) almost same for every string with same PW?

5 posts in this topic

#1 ·  Posted (edited)

I wish i can use one password to encrypt several strings but the problem is they end up almost all the same like if i encrypt

new york with password cities it will be something like 9881, washington encrypted with same pw will be something like 9882, Phoenix will be 9883 etc...

Is this really reliable way to encrypt things when people can just change one number in encrypted string and therefore get your data even if you dont want them to?

How can i encrypt strings with same password but make it that they are pretty much different so people can not guess like cities encrypted would instead be

Washington - 98CD

New York - 81X9

etc...

I tried to use deeper encrypt level but funny enough sometimes only 2 digits will change in that case no matter how deep your encrypt lvl is.

Maybe i am just paranoid but i i wish encryption would be different for each thing you encrypt while using same pw :D

Since i am using this for licensing algorythm i am working on you can see how this could cause problems like if user of program could just accidently hit another key and he would get completely different license!

Melba and others who perhaps know ways around this?

Edited by Aktonius

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Aktonius,

Simple answer - do not use _StringEncrypt! :rip:

Try _Crypt_EncryptData - a lot better: :oops:

#include <crypt.au3>

Global $aCities[3] = ["New York", "Washington", "Phoenix"]

_Crypt_Startup()

$hKey = _Crypt_DeriveKey("SomePassword", $CALG_RC4)

For $i = 0 To 2
    ; Encrypt the name
    $bEncrypted = _Crypt_EncryptData($aCities[$i], $hKey, $CALG_USERKEY)
    ; And then decrypt it
    $bDecrypted = _Crypt_DecryptData($bEncrypted, $hKey, $CALG_USERKEY)
    ; And display the 2 results
    ConsoleWrite($bEncrypted & " - " & BinaryToString($bDecrypted) & @CRLF)

Next

_Crypt_DestroyKey($hKey)
_Crypt_Shutdown()

All clear? :D

M23

Edit: Typnig!

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks Melba, Works great and i like this better!

edit: There are still some typos though (Crypt_Startup, _For) in case you wanna edit :D

Edited by Aktonius

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Aktonius,

It should have read _Crypt_Startup() and it is an optional initialisation of the Crypt UDF library - I suggest you put it back in! :oops:

M23

Edit: I see you worked it out - and I have fixed the typos (stupid copy/paste error). I really do not like this new post editor at all! :D

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Yep, i see now after checking the au3 help file, all good.

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