Jump to content
Sign in to follow this  
nht3004

About _StringEncrypt()

Recommended Posts

nht3004

I know _StringEncrypt() used to encode and decode a string.

But it can't use them for UNICODE Characters, please help me.

Example, when I do function encrypt _StringEncrypt(1,"Nản","a",1),it returns CD1237C4EA7F

And when I do decrypt _StringEncrypt(0,"CD1237C4EA7F","a",1), it returns N?n!]

Please help, thanks alot!


for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites
Mat

What I was trying to indicate, and what someone in that thread failed to relise is that it is more than likely you corrupting the characters, not stringEncrypt. I may be wrong, and I am not the most knowledgable person on this topic by any stretch of the imagination.

Make sure whatever text editor etc you are using is set to the right settings, as mentioned by valik in the thread.

Other than that, I cannot help you unless you post the editor you are using as well as the settings you have already changed. Just post any info that may have been affecting the output.

MDiesel

Share this post


Link to post
Share on other sites
KaFu

Derived from ProgAndy's code here:

#614497

#include <String.au3>

Global Const $SF_ANSI = 1
Global Const $SF_UTF8 = 4

$TestString_Raw = "Кириллица"

; Test 1
$TestString_Enc = _StringEncrypt(1, $TestString_Raw, "password", 1)
$TestString_Dec = _StringEncrypt(0, $TestString_Enc, "password", 1)
MsgBox(0,"Test 1, no conversion",$TestString_Raw & @crlf & $TestString_Enc & @crlf & $TestString_Dec)

; Test 2
$TestString_Enc = _StringEncrypt(1, BinaryToString(StringToBinary($TestString_Raw, $SF_UTF8), $SF_ANSI), "password", 1)
$TestString_Dec = BinaryToString(StringToBinary(_StringEncrypt(0, $TestString_Enc, "password", 1), $SF_ANSI), $SF_UTF8)
MsgBox(0,"Test 2, string converted", $TestString_Raw & @crlf & $TestString_Enc & @crlf & $TestString_Dec)

Share this post


Link to post
Share on other sites
nht3004

Derived from ProgAndy's code here:

#614497

#include <String.au3>

Global Const $SF_ANSI = 1
Global Const $SF_UTF8 = 4

$TestString_Raw = "Кириллица"

; Test 1
$TestString_Enc = _StringEncrypt(1, $TestString_Raw, "password", 1)
$TestString_Dec = _StringEncrypt(0, $TestString_Enc, "password", 1)
MsgBox(0,"Test 1, no conversion",$TestString_Raw & @crlf & $TestString_Enc & @crlf & $TestString_Dec)

; Test 2
$TestString_Enc = _StringEncrypt(1, BinaryToString(StringToBinary($TestString_Raw, $SF_UTF8), $SF_ANSI), "password", 1)
$TestString_Dec = BinaryToString(StringToBinary(_StringEncrypt(0, $TestString_Enc, "password", 1), $SF_ANSI), $SF_UTF8)
MsgBox(0,"Test 2, string converted", $TestString_Raw & @crlf & $TestString_Enc & @crlf & $TestString_Dec)
Thanks alot. it is really helpful. it works!

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

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  

×