Jump to content

Recommended Posts

Posted

I am trying to write a simple program where the person enters their MSN Passport ID ( the e-mail with which they registered on MSN) and is given a hash calculated from the addy.

It is going to be used in an installer for Windows Live Messenger as some of the tweaks I am adding are only added to a registry key under the users hash. For testing purposes I am using an input box to return the hash, although the returned number is way off base.

Here is the code I am trying to imitate

int getUserId(LPTSTR user)
{
    unsigned int x = 0;

    for (int i = 0; i < strlen(user); i++) {
        x = x * 101;
        x = x + towlower(user[i];);
        }

    return x;
}

Info can be found Here and Here adn an online convertor can be found Here.

This is my code which is totally wrong but I cannot get it to work

$string = InputBox('Passport ID', 'Please enter your MSN Passport e-mail', '', '', '', 120)

Dim $x = 0

For $i = 1 To StringLen($string)
    $x = $x * 101
    $x = $x + Asc(StringMid($string, $i, 1))
Next    

InputBox('Passport ID', 'Your MSN Used ID is :', $x, '', '', 120)

Hopefully someone can point out the obvious :P

Thank You

  • Moderators
Posted

Asc(StringLower(StringMid($string, $i, 1)))

?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Asc(StringLower(StringMid($string, $i, 1)))

?

Nah! I already tried that before, the installer will use an edit box that converts the text to lower case, but whilst struggling to get the code to work I switched to an input box and only use lower case.
  • Moderators
Posted (edited)

Nah! I already tried that before, the installer will use an edit box that converts the text to lower case, but whilst struggling to get the code to work I switched to an input box and only use lower case.

Well, I checked the output of the online thing, to what I just put up there, and it was the same.

Edit:

I only put in 3 chars... now that I've put in more, the result is not the same.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Well, I checked the output of the online thing, to what I just put up there, and it was the same.

Thanks for the replies,

We must be doing something different ;) If I use me@hotmail.com as the e-mail addy I get different numbers,

1. Online checker = 2408776353 correct

2. My code = -2470479917988248927 :P

The stringlower isn't doing anything as the e-mail is already lower case. What steps did you follow?.

  • Moderators
Posted

I think the issue you are having is reaching AutoIts max for integer numbers... Although off the top of my head, i can't recall what that is.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

  • Moderators
Posted

Here, try this:

$string = "me@hotmail.com";InputBox('Passport ID', 'Please enter your MSN Passport e-mail', '', '', '', 120)

Dim $tStruct = DllStructCreate("uint")
For $i = 1 To StringLen($string)
    DllStructSetData($tStruct, 1, DllStructGetData($tStruct, 1) * 101)
    DllStructSetData($tStruct, 1, DllStructGetData($tStruct, 1) + Asc(StringLower(StringMid($string, $i, 1))))
Next    

InputBox('Passport ID', 'Your MSN Used ID is :', DllStructGetData($tStruct, 1), '', '', 120)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

I think the issue you are having is reaching AutoIts max for integer numbers... Although off the top of my head, i can't recall what that is.

I was just browsing the help file and looking at stringformat to see if anything there would help, I think the limit is 65535.
Posted

Here, try this:

$string = "me@hotmail.com";InputBox('Passport ID', 'Please enter your MSN Passport e-mail', '', '', '', 120)

Dim $tStruct = DllStructCreate("uint")
For $i = 1 To StringLen($string)
    DllStructSetData($tStruct, 1, DllStructGetData($tStruct, 1) * 101)
    DllStructSetData($tStruct, 1, DllStructGetData($tStruct, 1) + Asc(StringLower(StringMid($string, $i, 1))))
Next    

InputBox('Passport ID', 'Your MSN Used ID is :', DllStructGetData($tStruct, 1), '', '', 120)
Nice 1 Sm0ke, it works :P now I just need to read through the help file and understand the code, Thanks

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