Jump to content

for and xor problems


Recommended Posts

hi,

i've got a problem

how can i make this (vb) script in autoit3?

for i = 1 to 4
a = code
encoded = a xor (64h + i) done

can i maybe some help,please?

I know nothing about vb, but I think the script probably wasn't quite what you have quoted. The for i = 1 to 4 needs a next somewhere; the a=code seems unecessarry; encoded will always result in the value when i - 4; what does 'done' mean.

Any way, the first problem is that I don't think that AutoIt has an exclusive or operator. (If I'm wrong someone will soon tell me I hope.)

Exclusive or means one or the other but not both.

64h means, I assume, 64 in hex. In autoIt this is written 0x64.

So the conversion would be

for $i = 1 to 4

$a = $code

$encoded = ($a OR (0x64 + $i)) AND (NOT($a AND (0x64 + $i)))

next

But as I said, this doen't make sense because it is the same as

$encode = ($code OR 0x68) AND (NOT($code AND 0x68))

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

BitXOR

Thanks Siao, stupid of me. :"> I regularly use BitOR and BitAND.

So the code would now be

for $i = 1 to 4
$a = $code
$encoded = BitXOR($a ,0x64 + $i)
next

;which is the same as

$encode = BitXOR($code , 0x68)
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

thnx, it works

but can u too make this code in au3?

#pseudo bash
for i in $(seq 0 $aantal); do offset = $(( $i × $sizerecord + pos)) dd if = leerling.dat skip = $offset bs = 4 count = 1 |od -tx 1 -v -An done

this code is a bit of differenter...

Link to comment
Share on other sites

thnx, it works

but can u too make this code in au3?

nope.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 2 weeks later...

this code doesn't give the right pass :S

for $i = 1 to 4

$a = $code

$encoded = BitXOR($a ,0x64 + $i)

next

;which is the same as

$encode = BitXOR($code , 0x68)

Maybe is Javascript easyer:

java script:var x="W^R^",y="The code ("+x+") was decoded to: ";for(var i=0;i<4;i++)y+=(x.charCodeAt(i)^(101+i))-48;alert(y);

If you try this code then you will get 2865

Can I maybe make a Autoit3 program?

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...