.NET Framework Bookmark and Share   
 index > 64-Bit .NET Framework Development > Will Thread.CurrentThread.GetHashCode() differ for 64 bit and 32 bit ?
 

Will Thread.CurrentThread.GetHashCode() differ for 64 bit and 32 bit ?

Hi All,

I have an engine which is target platform is X86. But is running on 64 bit environment. This engine does few processes with a thread pool count of 3. In that engine, am generating a random number using datetime and thread.GetHashCode() as below

Random random = new Random((int)DateTime.Now.Ticks + Thread.CurrentThread.GetHashCode());
By using this random,a 8 char password is generated. This password is assigned to a zip file process to open the zip file.


The problem is, for fewer files the password generated are not working.

Will Thread.CurrentThread.GetHashCode() differ for 32 bit which is running on 64 bit machine?

If I ran the engine under 32 bit machine, am not getting this problem.

Regards
Madhavan.TR

Madhavan thasuramachandran
Mysterious stuff, how could code ever guess the password correctly to unzip the file? It would have to get the exact same value for DateTime.Now.Ticks. That's unlikely to work in general, some machines have hardware that makes their Now.Ticks value increment a lot faster than once every 16 msec.

Hans Passant.
nobugz

You can use google to search for other answers

Custom Search

More Threads

• App uses 100% cpu on most x64 platforms
• MSI runs 32 bit, installed application runs 64 bit
• Assembly references cannot be found
• Will AnyCPU cause binaries to run as 64-bit on x64 machine
• CDaoDatabse support for 64bit or not
• Can't see Debug output from native-coce sub-component
• Managed C++/CLI Class DLL from 32/64 bits C# code
• Problem using NtQueryInformationProcess on XP64
• Useless error message when failing to attach
• Unable to access the MS Access database from 64 bit component