Author Topic: [C++] Another Hashing Method. Ugh, I know.  (Read 7958 times)

0 Members and 4 Guests are viewing this topic.

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: [C++] Another Hashing Method. Ugh, I know.
« Reply #15 on: November 04, 2005, 07:58:32 am »
The only reason I try to create methods of my own are just for the experience. I learned quite a few things by doing this (about C++).
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: [C++] Another Hashing Method. Ugh, I know.
« Reply #16 on: November 04, 2005, 08:41:21 am »
I just noticed, in a string with a length divisible by 4, the xor'ing will cancel itself out. 

Sidoh -- It depends on what the assignment was.  I usually mark the code itself, which would do well (except for the fact that he's using a string where a char[] would do :)).  The actual algorithm is rather flawed. 

And Joe -- there's better ways to learn, but as long as you're having fun, oh well :)

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: [C++] Another Hashing Method. Ugh, I know.
« Reply #17 on: November 04, 2005, 05:12:22 pm »
A little laugh for you all, Warrior had me looping through argv using WHILE, so I didn't know the UBound. I just waited for it to be null.

Code: [Select]
string toHash;
int i = 1;
while(argv[i] != NULL) {
  toHash =+ argv[i];
}

When argc holds the UBound.

Code: [Select]
char ignorantProgramming[] = "Lots of headache\x0";
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: [C++] Another Hashing Method. Ugh, I know.
« Reply #18 on: November 04, 2005, 05:33:06 pm »
That was of course assuming you had tried the previous (more practical) methods and failed.

Also nice job not incrementing 'i', retard.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: [C++] Another Hashing Method. Ugh, I know.
« Reply #19 on: November 04, 2005, 05:51:35 pm »
A little laugh for you all, Warrior had me looping through argv using WHILE, so I didn't know the UBound. I just waited for it to be null.

Code: [Select]
string toHash;
int i = 1;
while(argv[i] != NULL) {
  toHash =+ argv[i];
}

When argc holds the UBound.

Code: [Select]
char ignorantProgramming[] = "Lots of headache\x0";

You don't need a \x0 at the end of a string.  " and " imply that the string ends with a \0.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [C++] Another Hashing Method. Ugh, I know.
« Reply #20 on: November 04, 2005, 10:09:36 pm »
RoMi asked that, not me.  Silly.  :P