Sha256: ad3945eec4cc7bc1692e2a8e3141970d1e1266298f1867910f58891b812f69aa

Contents?: true

Size: 314 Bytes

Versions: 3

Compression:

Stored size: 314 Bytes

Contents

class String

  alias_method :_crypt, :crypt

  # Common Unix cryptography method.
  # This adds a default salt to the built-in crypt method.

  def crypt(salt=nil)
    salt ||= (
      (rand(26) + (rand(2) == 0 ? 65 : 97) ).chr +
      (rand(26) + (rand(2) == 0 ? 65 : 97) ).chr
    )
    _crypt(salt)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-2.9.0 lib/tour/facets/string/crypt.rb
facets-2.9.0.pre.2 lib/tour/facets/string/crypt.rb
facets-2.9.0.pre.1 lib/tour/facets/string/crypt.rb