   Pseudo random numbers staying same while PC on
  Hello,Are there some pseudo random numbers that I can retrieve from the OS (Win xp/vista/7) and that stay same while the PC is on?The time in seconds at which the PC was turned on could be one.Thanks   
Quote:Original post by floatingwoodsAre there some pseudo random numbers that I can retrieve from the OS (Win xp/vista/7) and that stay same while the PC is on?4.It will stay the same, and is random.Unless there is a certain distribution of randomness that must be followed between individual sessions. Otherwise, the above will do fine.   ;  Well, I meant with good probability to be different next time the pc is turned on!   ;Quote:Original post by floatingwoodsWell, I meant with good probability to be different next time the pc is turned on!Unless the randomness source has memory, then 4 still satisfies that condition.What is the purpose of this random number anyway?   ;Quote:Original post by AntheusQuote:Original post by floatingwoodsWell, I meant with good probability to be different next time the pc is turned on!Unless the randomness source has memory, then 4 still satisfies that condition.What is the purpose of this random number anyway?To uniquely identify a machine from one session to the next (linked to a floating license system). ...and I don't want to use the volume ID of the HDD, since HDDs are often cloned (where floating licenses are in use);Quote:Original post by floatingwoodsTo uniquely identify a machine from one session to the next (linked to a floating license system). ...and I don't want to use the volume ID of the HDD, since HDDs are often cloned (where floating licenses are in use)And the big bowl of worms rears its ugly head...- What about Hibernate, Sleep?- What about VM migration and image cloning?- What constitutes a session? Power-on? Fast-user switching (user X logs in, but 20 others use the machine)? - What about terminal sessions?- Who are licenses issued to? User or machine?It's just a nightmare.For Enterprise, tapping into ActiveDirectory or similar via some licensing server would work.Another way is to run licensing service on machine, which requests unique token on start, or simply generates a random number.There is hardware one could query, but that is highly unreliable due to lack of ubiquitous support.It's a well known and, for most purposes unsolvable problem due to impossibility of accurately establishing unique identity.   ;  Thanks Antheus,never mind, I am not looking for the perfect system. Just good enough for most situations/usage   ;  Been there, there's no easy solution. I wanted to have a unique "boot ID" for troubleshooting (basically, if it's the same then the user didn't reboot the machine as certain software requires, and in the case I ask them to reboot and try again), and after looking around a lot, I ended up writing an NT service that generates a random block on every boot, which is used as the boot ID. Keep in mind that this was *NOT* intended for DRM or licenses or whatever - the only intention was to provide a helpful message to the user, and thus this code was not likely to be attacked and is not foolproof (you can always stop and re-start the service). It worked for me though (And the impact on the system was minimal - the service shared its svchost process with others, and the thread remained in a wait state till a request for the boot ID was made).   ;Quote:Original post by floatingwoodsThanks Antheus,never mind, I am not looking for the perfect system. Just good enough for most situations/usageKeep your ROI in mind - the "good enough" system might take you two weeks to implement and be cracked in under one hour. DRM is near impossible on PC software, where the user must have access to the encrypted data, the decryption key and the algorithm in order to view the content - same user who also has physical and root access to the system. Good luck.   ;  Can something like this work:Manually create a file with just 1 number, say 0.The every time you open up the computer, have a program read in the number in. Andwhen *done, rewrite the number into the file, but increment it before writing it to file.Just an random thought.------------------------------------*done, is something you need to define.   