C++ Password Seed

02/13/2011 19:54 unknownone#16
Again, you can't just use any random numbers. You must use the specific ones produced by rand(), otherwise the client and the server are not going to have the same cryptography. The psuedo-random numbers are used such that the server and client will always produce the same result, and thus be able to decrypt/encrypt the password.

Ok, perhaps I misread. You're referring to what value you can put into the seed packet: In that case, anything. But you must then use that same value in your call to srand() to seed your RC5.
02/13/2011 19:58 Basser#17
Quote:
Originally Posted by Mr_PoP View Post
well this one works :

Code:
//random seed
void rPassSeed(char *seed)
{
	srand ( time(NULL) );
	char k[8];
	for (int i=0;i<8;i++)
	{
		k[i]=rand()%10;
	}
	sprintf(seed,"%d%d%d%d%d%d%d%d",k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7]);
}
You realize there is no such thing as random in whatever programming language?
02/13/2011 20:03 Mr_PoP#18
Quote:
Originally Posted by unknownone View Post
Again, you can't just use any random numbers. You must use the specific ones produced by rand(), otherwise the client and the server are not going to have the same cryptography. The psuedo-random numbers are used such that the server and client will always produce the same result, and thus be able to decrypt/encrypt the password.

Ok, perhaps I misread. You're referring to what value you can put into the seed packet: In that case, anything. But you must then use that same value in your call to srand() to seed your RC5.
ah i see so this one good?

Code:
void r(char *w)
{
	char k[8];
	for (int i=0;i<8;i++)
	{
		k[i]=rand()%10;
	}
	sprintf(w,"%d%d%d%d%d%d%d%d",k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7]);
}

int main()
{
	char test[9];
	r(test);
	cout << test;
}
02/13/2011 20:06 unknownone#19
You sprintf is pointless. You never need to read the value as text, only send it as an ineteger. In the case, you only need 4 bytes, and you can simply make an int point to the array location for it. It really doesn't matter what you send in that packet. Since you appear to be just starting out anyway, it might be better for you to just put a constant value as the seed for now. You can always update it later.
02/13/2011 20:12 _tao4229_#20
Quote:
Originally Posted by Basser View Post
You realize there is no such thing as random in whatever programming language?
False.
[Only registered and activated users can see links. Click Here To Register...]
02/14/2011 03:47 bone-you#21
Quote:
Originally Posted by _tao4229_ View Post
False.
[Only registered and activated users can see links. Click Here To Register...]
False. There are no random numbers in computing. The numbers are all coming from something. When I ask you to give me a random number from your head, you will just think of a random number. The source of that number is nothing. If you ask a computer to generate a random number, it cannot give you a number based on nothing. It must either pull a piece of memory or do some calculations. Both are subject to the flaw that if that section of memory is the same for each consecutive call, it will give the same random number. Also, if the seed given for the calculations is the same, it will give the same random number. There is no truly random to computers. If I say 4,5,6,7,2,5,1,5,7,5,4,1,8,1,1,6,1, that was completely random. There was no basis to them. I just looked away and pressed random keys. Because air friction, movement of my body, etc, is never the same for each press, it truly is random as the same exact conditions would never happen again.

tl;dr, computers can't generate random numbers.
02/14/2011 04:15 _tao4229_#22
Quote:
Originally Posted by bone-you View Post
False. There are no random numbers in computing. The numbers are all coming from something. When I ask you to give me a random number from your head, you will just think of a random number. The source of that number is nothing. If you ask a computer to generate a random number, it cannot give you a number based on nothing. It must either pull a piece of memory or do some calculations. Both are subject to the flaw that if that section of memory is the same for each consecutive call, it will give the same random number. Also, if the seed given for the calculations is the same, it will give the same random number. There is no truly random to computers. If I say 4,5,6,7,2,5,1,5,7,5,4,1,8,1,1,6,1, that was completely random. There was no basis to them. I just looked away and pressed random keys. Because air friction, movement of my body, etc, is never the same for each press, it truly is random as the same exact conditions would never happen again.

tl;dr, computers can't generate random numbers.
Measurement in quantum mechanics - Wikipedia, the free encyclopedia

tl;dr, generates randomness just like the universe and us.
you're getting trolled.
02/14/2011 04:32 unknownone#23
Some would argue that nothing in the universe is random. Humans certainly aren't - you can program them as easily as any computer if you control what information goes in.
02/14/2011 04:48 _tao4229_#24
Quote:
Originally Posted by unknownone View Post
Some would argue that nothing in the universe is random. Humans certainly aren't - you can program them as easily as any computer if you control what information goes in.
Some would.
However the randomness of a quantum state is as close to random as one can observe (except that you can't).
02/14/2011 06:53 bone-you#25
Quote:
Originally Posted by _tao4229_ View Post
Measurement in quantum mechanics - Wikipedia, the free encyclopedia

tl;dr, generates randomness just like the universe and us.
you're getting trolled.
Quote:
The measurement process is often said to be random and indeterministic. (However, there is considerable dispute over this issue; in some interpretations of quantum mechanics, the result merely appears random and indeterministic, in other interpretations the indeterminism is core and irreducible.) This because an important aspect of measurement is wavefunction collapse, the nature of which varies according to the interpretation adopted.
.
02/15/2011 11:20 Syst3m_W1z4rd#26
Found this interesting: (I don't take credits)
[Only registered and activated users can see links. Click Here To Register...]