class Keybase::Core::Crypto

@private

Constants

SCRYPT_VARS

Public Class Methods

hex2bin(hex) click to toggle source
# File lib/keybase-core/crypto.rb, line 16
def self.hex2bin(hex)
  [hex].pack("H*")
end
hmac_sha512(key, data) click to toggle source
# File lib/keybase-core/crypto.rb, line 12
def self.hmac_sha512(key, data)
  OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA512.new, key, Base64.decode64(data))
end
scrypt(passphrase, salt) click to toggle source
# File lib/keybase-core/crypto.rb, line 5
def self.scrypt(passphrase, salt)
  SCrypt::Engine.scrypt(passphrase, hex2bin(salt),
                               SCRYPT_VARS['N'], SCRYPT_VARS['r'],
                               SCRYPT_VARS['p'], SCRYPT_VARS['key_length']
                             )[SCRYPT_VARS['chunk']]
end