[C++] Another Hashing Method. Ugh, I know.

Started by Joe, November 03, 2005, 06:29:55 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Joe

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++).
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


iago

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 :)

Joe

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.

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


When argc holds the UBound.

char ignorantProgramming[] = "Lots of headache\x0";
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Warrior

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

iago

Quote from: Joe[e2] 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.

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


When argc holds the UBound.

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.

Sidoh