Пример #1
0
        public Secp256k1()
        {
            LibPath = LibPathResolver.Resolve(LIB);
            _libPtr = LoadLibNative.LoadLib(LibPath);

            secp256k1_context_create   = LazyDelegate <secp256k1_context_create>();
            secp256k1_ecdsa_recover    = LazyDelegate <secp256k1_ecdsa_recover>();
            secp256k1_ec_pubkey_create = LazyDelegate <secp256k1_ec_pubkey_create>();
            secp256k1_ec_seckey_verify = LazyDelegate <secp256k1_ec_seckey_verify>();
            secp256k1_ecdsa_recoverable_signature_parse_compact = LazyDelegate <secp256k1_ecdsa_recoverable_signature_parse_compact>();
            secp256k1_ecdsa_sign_recoverable = LazyDelegate <secp256k1_ecdsa_sign_recoverable>();
            secp256k1_ecdsa_recoverable_signature_serialize_compact = LazyDelegate <secp256k1_ecdsa_recoverable_signature_serialize_compact>();
            secp256k1_ec_pubkey_serialize       = LazyDelegate <secp256k1_ec_pubkey_serialize>();
            secp256k1_context_destroy           = LazyDelegate <secp256k1_context_destroy>();
            secp256k1_ec_pubkey_parse           = LazyDelegate <secp256k1_ec_pubkey_parse>();
            secp256k1_ecdsa_signature_normalize = LazyDelegate <secp256k1_ecdsa_signature_normalize>();
            secp256k1_ecdsa_verify = LazyDelegate <secp256k1_ecdsa_verify>();
            secp256k1_ecdsa_sign   = LazyDelegate <secp256k1_ecdsa_sign>();
            secp256k1_ecdh         = LazyDelegate <secp256k1_ecdh>();

            _ctx = secp256k1_context_create.Value(((uint)(Flags.SECP256K1_CONTEXT_SIGN | Flags.SECP256K1_CONTEXT_VERIFY)));
        }
Пример #2
0
        Lazy <TDelegate> LazyDelegate <TDelegate>()
        {
            var symbol = SymbolNameCache <TDelegate> .GetSymbolName();

            return(new Lazy <TDelegate>(() => LoadLibNative.GetDelegate <TDelegate>(_libPtr.Value, symbol), isThreadSafe: true));
        }
Пример #3
0
        Lazy <TDelegate> LazyDelegate <TDelegate>()
        {
            var symbol = SymbolNameCache <TDelegate> .SymbolName;

            return(new Lazy <TDelegate>(() => LoadLibNative.GetDelegate <TDelegate>(_libPtr, symbol), isThreadSafe: false));
        }