Validate type of iterations and derived_key if scheme is pbkdf2
Improve _sum and _stats JS equivalents