I think this is really tough question, but lets try.
I'm implementing small software in J2ME environment. Part of that software is to encrypt a small txt-file using a password based encryption. I'm using SATSA (Security And Trusted Services API, JSR177) for actual encryption. However, I need to generate a key for that encryption process. Key generation must be done using so called "slow funcktion". I have decided to use PBKDF2 algorithm for that purpose (see: http://www.ietf.org/rfc/rfc2898.txt)
At the moment I have started to implement PBKDF2 for J2ME. I can do everything else, but I have a problem creating PRF (Pseudo Random Function), that is used in key generation process. I can' use Mac and SecretKeySpec classes, that are part of JavaSE:
Donald Knuth defines a PRF algorithm in his seminal work "The Art of Computer Programming". Basically, it chops the preceeding number in the series into 2 parts, then merges the parts using simple arithmetic.
You should be able to google for Random Number Generator Algorithm and find lots of code.
Sometimes the only way things ever got fixed is because people became uncomfortable.
Acetylsalicylic acid is aspirin. This could be handy too:
Free, earth friendly heat - from the CodeRanch trailboss