I have the current codethis in place for aan RSA Key generation class,. I force the user to swipe on the screen randomly and use that as a entropy pool.
class TouchRandom extends SecureRandom {
private final Stack<Byte> pool = new Stack<>();
@Override
public synchronized void nextBytes(byte[] bytes) {
for (int i = 0; i < bytes.length; i++) {
bytes[i] = pool.pop();
}
}
void addToPool(byte b) {
pool.push(b);
}
}
And here is how I feed the pool:
@Override
public boolean onTouchEvent(MotionEvent event) {
touchRandom.addToPool((byte) event.getX());
touchRandom.addToPool((byte) event.getY());
return false;
}
Is this better or worse than a PRNG based on a Elliptic Curve or something else?
Idea(Idea shamelessly stolen from VeraCrypt.)