Module: PQCrypto::Internal

Defined in:
lib/pq_crypto/internal.rb

Class Method Summary collapse

Class Method Details

.binary_string(value) ⇒ Object



7
8
9
# File 'lib/pq_crypto/internal.rb', line 7

def binary_string(value)
  String(value).b
end

.constant_time_equal?(left, right) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/pq_crypto/internal.rb', line 19

def constant_time_equal?(left, right)
  PQCrypto.__send__(:native_ct_equals, left, right)
end

.safe_wipe(value) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/pq_crypto/internal.rb', line 11

def safe_wipe(value)
  return unless value.is_a?(String) && !value.frozen?

  PQCrypto.secure_wipe(value)
rescue ArgumentError
  nil
end