A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://rubydoc.info/github/cryptosphere/rbnacl/RbNaCl/PasswordHash/SCrypt below:

SCrypt – Documentation for cryptosphere/rbnacl (main) – RubyDoc.info

Class: RbNaCl::PasswordHash::SCrypt
Inherits:
Object show all
Extended by:
Sodium
Defined in:
lib/rbnacl/password_hash/scrypt.rb
Overview

The scrypt sequential memory hard password hashing function

scrypt is a password hash (or password based KDF). That is to say, where most hash functions are designed to be fast because hashing is often a bottleneck, scrypt is slow by design, because it’s trying to “strengthen” the password by combining it with a random “salt” value then perform a series of operation on the result which are slow enough to defeat brute-force password cracking attempts.

scrypt is similar to the bcrypt and pbkdf2 password hashes in that it’s designed to strengthen passwords, but includes a new design element called “sequential memory hardness” which helps defeat attempts by attackers to compensate for their lack of memory (since they’re typically on GPUs or FPGAs) with additional computation.

Instance Method Summary collapse Methods included from Sodium

primitive, sodium_constant, sodium_function, sodium_function_with_return_code, sodium_primitive, sodium_type

Constructor Details #initialize(opslimit, memlimit, digest_size = 64) ⇒ RbNaCl::PasswordHash::SCrypt

Create a new SCrypt password hash object

39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rbnacl/password_hash/scrypt.rb', line 39

def initialize(opslimit, memlimit, digest_size = 64)
    @opslimit = opslimit
  @memlimit = memlimit

      
  @digest_size = digest_size
end
Instance Method Details #digest(password, salt) ⇒ String

Calculate an scrypt digest for a given password and salt

57
58
59
60
61
62
63
64
65
# File 'lib/rbnacl/password_hash/scrypt.rb', line 57

def digest(password, salt)
  digest = Util.zeros(@digest_size)
  salt   = Util.check_string(salt, SALTBYTES, "salt")

  success = self.class.scrypt(digest, @digest_size, password, password.bytesize, salt, @opslimit, @memlimit)
  raise CryptoError, "scrypt failed!" unless success

  digest
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4