News Item: : Towards Steganography II: a pseudo-random number generator
(Category: Tech related)
Posted by yiangos
Tuesday 07 July 2009 - 02:19:27
I've shown the inner workings of the first essential component for my steganography project in a previous post here. The second essential part is a pseudo-random number generator (PRNG) that's seedable.
I could use the .NET framework built-in PRNG, but since I have no control over it, I can never be certain that Microsoft will always keep the same algorithm for its PRNG. Now, seeing how crucial the PRNG is in the scheme, I believe the way to go is to implement a custom one.
I know that PRNG's are supposed to be split into two categories, the ones that are safe to use in cryptography and the ones that aren't. Also, by searching, I've found that there is a very good PRNG that's safe for cryptography; the Yarrow PRNG. However, I can't really make out the C/C++ implementation. The ISAAC PRNG, which seemed like a nice equivalent, I was also unable to use for some reason. My attempts to use a cryptographically safe PRNG stopped there.
In the end, I wrote down a vb.net implementation of the central PRNG I found here. It is definitely a very "weak" PRNG, in that it is not safe for cryptography: it is a well known algorithhm, that produces a number sequence that's relatively easy to predict. Apparently, I'll factor this out in a separate library, so that if I manage to get a different PRNG, I can simply replace the dll - or have them both working side -by-side and choose which I want to use each time.
The PRNG lies within a class named "Shuffler". This class has two constructors. One that seeds the PRNG with a number generated using the current datetime, and one that takes a seed as argument. The class has only one public method:
Public Function Shuffle(ByVal rangemax As Long, ByVal totalnum As Long) As Long()
This method produces an array with totalnum different integers between zero and rangemax.
The zip contains the full solution for this part of the project.
This news item is from Midnight blogging
( http://yiannis.vavouranakis.gr/myblog/news.php?extend.41 )