Results 1 to 10 of 16

Thread: String handling issue with Free Pascal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Thanks for your reply! Seems like I was a bit confusing. The function is nice, but it doesn't solve my issues. The code above was not part of my program, just a quick example of the source of my problem.

    The main problem is that I can't get the program to test through all variations. It's a mathematical problem that I can't solve because of the weird way Pascal handles strings. This is what my program should really do:

    Input1: Hash: e2075474294983e013ee4dd2201c7a73
    Input2: Estimated maximum length of original characters: 4
    Process:
    Md5('0')->0
    Md5('1')->0
    Md5('2')->0
    Md5('3')->0
    .
    .
    .
    Md5('9')->0
    Md5('a')->0
    Md5('b')->0
    .
    .
    .
    Md5('z')->0
    Md5('00')->0
    Md5('01')->0
    Md5('02')->0
    .
    .
    .
    Md5('0a')->0
    Mdt('0b')->0
    .
    .
    .
    Md5('a9')->0
    Md5('aa')->0
    Md5('ab')->0
    Md5('ac')->Match Found
    Md5('ad')->0
    .
    .
    .
    Md5('zzzz')->0

    Output: 1 Match found: ac



    Pascal has this nice function in the Md5 unit:

    hash:=Md5Print(Md5String(string));

    So hashing all the possible combinations, once they are generated, is not an issue.

    See if there is a match is not an issue, since a single 'if' condition in the loop will do fine.

    Making the program generate all the possible variations is the issue, because I can't write a procedure that handles string lengths dynamically. In Pascal your string must have a defined length, and you can't change that. Only deleting from the string, or adding to a string will change its length and it makes things very complicated in this case.

    And no, lol I don't want to use it to break your passwords. Besides I wouldn't be able to. When I got my activation code it wasn't hashed in md5 so I guess your passwords aren't stored in md5 either (which is a pretty good decision as it is getting less and less secure). Cheers

  2. #2
    @User137
    That will be implemented in the program, but first I need to optimize other things. If I want to add capitalized characters into the pool of characters my program uses, then it adds another 23 characters and it will make things a hell lot slower even without the NextChar function.

    @Athena
    That's a really cool guide you have written but erm... The basics, you say?? Unfortunately for me I could understand it until the second page, and there were things I didn't understand on the first page too(VCL thread??, TDXTimer??). It's just too advanced stuff for me. I don't know most of these functions. I don't know how classes handle these public and protected stuffs, or what's that constructor thing, how does inheriting work, what the hell does "try", "except", and "finally" do etc...etc... Hell, I don't even know how the OS exactly handles multithreading. How am I supposed to tell it how to do it, if I don't even know how it should be working? And finally, I also have no idea about how exactly can I use multithreading to fasten up this program. My program does one thing, and it is trying all different combinations of characters, so I don't see what tasks I could give to another thread. See I'm having difficulties with understanding the most basic things about multithreading, that's why I said I needed to study it a bit before I can implement it in my program.

  3. #3
    Quote Originally Posted by Sogcelak View Post
    @User137
    That will be implemented in the program, but first I need to optimize other things. If I want to add capitalized characters into the pool of characters my program uses, then it adds another 23 characters and it will make things a hell lot slower even without the NextChar function.

    @Athena
    That's a really cool guide you have written but erm... The basics, you say?? Unfortunately for me I could understand it until the second page, and there were things I didn't understand on the first page too(VCL thread??, TDXTimer??). It's just too advanced stuff for me. I don't know most of these functions. I don't know how classes handle these public and protected stuffs, or what's that constructor thing, how does inheriting work, what the hell does "try", "except", and "finally" do etc...etc... Hell, I don't even know how the OS exactly handles multithreading. How am I supposed to tell it how to do it, if I don't even know how it should be working? And finally, I also have no idea about how exactly can I use multithreading to fasten up this program. My program does one thing, and it is trying all different combinations of characters, so I don't see what tasks I could give to another thread. See I'm having difficulties with understanding the most basic things about multithreading, that's why I said I needed to study it a bit before I can implement it in my program.
    I think you need to have a look here. It's a Delphi "starters" site, were most of the language is explained. It is not very updated to last Delphi version, but the basics are there.

  4. #4
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2
    Quote Originally Posted by pitfiend View Post
    I think you need to have a look here. It's a Delphi "starters" site, were most of the language is explained. It is not very updated to last Delphi version, but the basics are there.
    I would also add http://www.pp4s.co.uk/main/tutorials.html. A good friend of mine has been using the PP4S tutorials to teach herself Delphi and she's found them pretty good although they do have a preference for Free Pascal.
    :: AthenaOfDelphi :: My Blog :: My Software ::

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •