Results for: "OptionParser"

Obtains a lock, runs the block, and releases the lock when the block completes. See the example under Thread::Mutex.

Closes the queue. A closed queue cannot be re-opened.

After the call to close completes, the following are true:

ClosedQueueError is inherited from StopIteration, so that you can break loop block.

Example:

q = Thread::Queue.new
Thread.new{
  while e = q.deq # wait for nil to break loop
    # ...
  end
}
q.close

Returns true if the queue is closed.

Returns true if the queue is empty.

Removes all objects from the queue.

Retrieves data from the queue.

If the queue is empty, the calling thread is suspended until data is pushed onto the queue. If non_block is true, the thread isn’t suspended, and ThreadError is raised.

If timeout seconds have passed and no data is available nil is returned. If timeout is 0 it returns immediately.

Similar to Thread::Queue#close.

The difference is behavior with waiting enqueuing threads.

If there are waiting enqueuing threads, they are interrupted by raising ClosedQueueError(‘queue closed’).

Returns true if the queue is empty.

Removes all objects from the queue.

Retrieves data from the queue.

If the queue is empty, the calling thread is suspended until data is pushed onto the queue. If non_block is true, the thread isn’t suspended, and ThreadError is raised.

If timeout seconds have passed and no data is available nil is returned. If timeout is 0 it returns immediately.

Returns true if key is a key in self, otherwise false.

Removes all map entries; returns self.

Returns URL-escaped string following RFC 3986.

Returns URL-unescaped string following RFC 3986.

URL-encode a string following RFC 3986 Space characters (+“ ”+) are encoded with (+“%20”+)

url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred")
   # => "%27Stop%21%27%20said%20Fred"

URL-decode a string following RFC 3986 with encoding(optional).

string = CGI.unescapeURIComponent("%27Stop%21%27+said%20Fred")
   # => "'Stop!'+said Fred"

Resets the digest to the initial state and returns self.

This method is overridden by each implementation subclass.

If none is given, returns the resulting hash value of the digest in a base64 encoded form, keeping the digest’s state.

If a string is given, returns the hash value for the given string in a base64 encoded form, resetting the digest to the initial state before and after the process.

In either case, the return value is properly padded with ‘=’ and contains no line feeds.

Returns the resulting hash value and resets the digest to the initial state.

No documentation available

Creates a global method from the given C signature.

The Fiddle::CompositeHandler instance

Will raise an error if no handlers are open.

Reads a one-character string from the stream. Raises an EOFError at end of file.

Closes the SSLSocket and flushes any unwritten data.

Derives a key from pass using given parameters with the scrypt password-based key derivation function. The result can be used for password storage.

scrypt is designed to be memory-hard and more secure against brute-force attacks using custom hardwares than alternative KDFs such as PBKDF2 or bcrypt.

The keyword arguments N, r and p can be used to tune scrypt. RFC 7914 (published on 2016-08, www.rfc-editor.org/rfc/rfc7914#section-2) states that using values r=8 and p=1 appears to yield good results.

See RFC 7914 (www.rfc-editor.org/rfc/rfc7914) for more information.

Parameters

pass

Passphrase.

salt

Salt.

N

CPU/memory cost parameter. This must be a power of 2.

r

Block size parameter.

p

Parallelization parameter.

length

Length in octets of the derived key.

Example

pass = "password"
salt = SecureRandom.random_bytes(16)
dk = OpenSSL::KDF.scrypt(pass, salt: salt, N: 2**14, r: 8, p: 1, length: 32)
p dk #=> "\xDA\xE4\xE2...\x7F\xA1\x01T"
Search took: 8ms  ·  Total Results: 6041