webcrank.password

Passwords

object Passwords extends Serializable

Build passwords structure using default (overridable) algorithm parameters.

Each algorithm has sensible defaults, but consider careful research and potentailly doing computation tests on your hardware to make the most appropriate choice (read as: set as high as you can before the performance becomes crippling).

In terms of algorithms selection there are a few factors that should be considered:

Availability of algorithm

Of the provided algorithms scrypt, bcrypt and PBKDF2 with HMAC-SHA1 are always available. PBKDF2 with HMAC-SHA256 or HMAC-SHA512 are only available on JDK8 or with a custom JCE provider such as IAIK or BSAFE.

The fact that PBKDF2 is stuck with HMAC-SHA1 by default potentially makes it less desirable.

Trust of underlying implementaion

Trust of underlying implementations is difficult, but all implementations are open source and can be audited:

There is some ongoing effort to complete a review of the scrypt and bcrypt implementations.

Work factors

Work factors of underlying algorithm is also difficult to classify because of the number of variables invloved (CPU, Memory, etc...).

Reading is possibly the only solution, but it is worth noting that scrypt was specifically designed to be more difficult to run with modern computing constraints (or lack there of) on FGPAs and alike. Scrypt is build on top of PBKDF2 with HMAC-SHA256. The [scrypt paper](http://www.tarsnap.com/scrypt/scrypt.pdf) has some insight into this.

In terms of choosing appropriate factors, measurement is often the best approach. As a general rule you would want to tune the algorithm so password generation takes ~100ms. There are some factors listed in the OWASP password cheatsheet which is a pretty good source of information

Validation requirements

Validation requirements are easier. You will know if you have them. PBKDF2 is the only NIST approved algorithm.

Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Passwords
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def bcrypt(cost: Int = 12): Passwords

    Use BCrypt for derivation.

    Use BCrypt for derivation.

    Default parameters: cost = 12.

    Note that work factor for bcrypt increases at 2^{cost}.

  6. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  16. def pbkdf2(rounds: Int = 65536, saltbytes: Int = 16, size: Int = 256, digest: Digest = SHA1): Passwords

    Use PBKDF2 for derivation.

    Use PBKDF2 for derivation.

    Default parameters: rounds = 65536 (2 ^ 16), salt length: 16 bytes, key size: 256 bits, digest = SHA1.

    Note: That SHA256 and SHA512 can only be used with JDK8+ or with a custom JCE provider that supports this algorithm such as BSAFE or IAIK. Excepting this limitations SHA2 algorithms would normally be preferred.

  17. def scrypt(n: Int = 65536, r: Int = 8, p: Int = 1): Passwords

    Use SCrypt for derivation.

    Use SCrypt for derivation.

    Default parameters: N = 65536 (2 ^ 16). r = 8, p = 1

  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  19. def toString(): String

    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped