Module: Secp256k1::C

Extended by:
FFI::Library
Included in:
Secp256k1
Defined in:
lib/secp256k1/c.rb

Overview

C interface

Constant Summary collapse

SILENTPAYMENTS_AVAILABLE =

for SilentPayments module

begin
  attach_function(:secp256k1_silentpayments_sender_create_outputs, [:pointer, :pointer, :pointer, :size_t, :pointer, :pointer, :size_t, :pointer, :size_t], :int)
  attach_function(:secp256k1_silentpayments_recipient_label_parse, [:pointer, :pointer, :pointer], :int)
  attach_function(:secp256k1_silentpayments_recipient_label_serialize, [:pointer, :pointer, :pointer], :int)
  attach_function(:secp256k1_silentpayments_recipient_label_create, [:pointer, :pointer, :pointer, :pointer, :uint32], :int)
  attach_function(:secp256k1_silentpayments_recipient_create_labeled_spend_pubkey, [:pointer, :pointer, :pointer, :pointer], :int)
  attach_function(:secp256k1_silentpayments_recipient_prevouts_summary_create, [:pointer, :pointer, :pointer, :pointer, :size_t, :pointer, :size_t], :int)
  attach_function(:secp256k1_silentpayments_recipient_scan_outputs, [:pointer, :pointer, :pointer, :pointer, :size_t, :pointer, :pointer, :pointer, :pointer, :pointer], :int)
  true
rescue FFI::NotFoundError
  false
end
SHA256_COMPRESSION_AVAILABLE =
begin
  attach_function(:secp256k1_context_set_sha256_compression, [:pointer, :pointer], :void)
  true
rescue FFI::NotFoundError
  false
end

Class Method Summary collapse

Class Method Details

.ecdh_hash_function_defaultFFI::Pointer

Pointer to secp256k1_ecdh_hash_function_default constant.

Returns:

  • (FFI::Pointer)


146
147
148
# File 'lib/secp256k1/c.rb', line 146

def self.ecdh_hash_function_default
  FFI::Pointer.new(secp256k1_ecdh_hash_function_default)
end

.ecdh_hash_function_sha256FFI::Pointer

Pointer to secp256k1_ecdh_hash_function_sha256 constant (the default ECDH hash function).

Returns:

  • (FFI::Pointer)


140
141
142
# File 'lib/secp256k1/c.rb', line 140

def self.ecdh_hash_function_sha256
  FFI::Pointer.new(secp256k1_ecdh_hash_function_sha256)
end

.ellswift_xdh_hash_function_bip324FFI::Pointer

Pointer to secp256k1_ellswift_xdh_hash_function_bip324 constant.

Returns:

  • (FFI::Pointer)


134
135
136
# File 'lib/secp256k1/c.rb', line 134

def self.ellswift_xdh_hash_function_bip324
  FFI::Pointer.new(secp256k1_ellswift_xdh_hash_function_bip324)
end

.sha256_compression_available?Boolean

Whether the loaded libsecp256k1 supports secp256k1_context_set_sha256_compression.

Returns:

  • (Boolean)


128
129
130
# File 'lib/secp256k1/c.rb', line 128

def self.sha256_compression_available?
  SHA256_COMPRESSION_AVAILABLE
end

.silentpayments_available?Boolean

Whether the loaded libsecp256k1 supports the silentpayments module.

Returns:

  • (Boolean)


122
123
124
# File 'lib/secp256k1/c.rb', line 122

def self.silentpayments_available?
  SILENTPAYMENTS_AVAILABLE
end