code: func (p *Params) Check() error {
  	// Validate N
  	if p.N > maxInt || p.N <= 1 || p.N%2 != 0 {
  		return ErrInvalidParams
  	}
  
  	// Validate r
  	if p.R < 1 || p.R > maxInt {
  		return ErrInvalidParams
  	}
  
  	// Validate p
  	if p.P < 1 || p.P > maxInt {
  		return ErrInvalidParams
  	}
  
  	// Validate that r & p don't exceed 2^30 and that N, r, p values don't
  	// exceed the limits defined by the scrypt algorithm.
  	if uint64(p.R)*uint64(p.P) >= 1<<30 || p.R > maxInt/128/p.P || p.R > maxInt/256 || p.N > maxInt/128/p.R {
  		return ErrInvalidParams
  	}
  
  	// Validate the salt length
  	if p.SaltLen < minSaltLen || p.SaltLen > maxInt {
  		return ErrInvalidParams
  	}
  
  	// Validate the derived key length
  	if p.DKLen < minDKLen || p.DKLen > maxInt {
  		return ErrInvalidParams
  	}
  
  	return nil
  }
docs: // Check checks that the parameters are valid for input into the
  // scrypt key derivation function.