Jump to content

Recommended Posts

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
  • Moderators
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

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:

  Reveal hidden contents

 

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
  • Moderators
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

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:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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