package fortuna.entropySources.mouse;

/**
 *
 * @author Viliam Krizan
 */


public class MouseData {
    
    private int actualX=0;
    private int prev1X=0;
    private int prev2X=0;
    
    private int actualY=0;
    private int prev1Y=0;
    private int prev2Y=0;
    
    private int entropyX;
    private int entropyY;
    private byte[] data = new byte[2];
    
    
    public  byte[] processData(int x, int y){
        prev2X = prev1X;
        prev1X = actualX;
        actualX = x;
        
        prev2Y = prev1Y;
        prev1Y = actualY;
        actualY = y;
        
        derivation();
        data[0] = (byte)entropyX;
        data[1] = (byte)entropyY;
        return data;
    }
    
    private  void derivation(){
        entropyX  = actualX - prev1X + prev2X;
        entropyY  = actualY - prev1Y + prev2Y;
    }
}
