Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
01bf8f93
"README.md" did not exist on "89933c1df40aaa6d10b4482c5d2e51739c47e8bd"
Commit
01bf8f93
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
c wrapper: add dht_infohash_get
parent
22741436
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
c/opendht.cpp
+5
-0
5 additions, 0 deletions
c/opendht.cpp
c/opendht_c.h
+2
-1
2 additions, 1 deletion
c/opendht_c.h
with
7 additions
and
1 deletion
c/opendht.cpp
+
5
−
0
View file @
01bf8f93
...
...
@@ -22,6 +22,11 @@ void dht_infohash_random(dht_infohash* h)
*
reinterpret_cast
<
dht
::
InfoHash
*>
(
h
)
=
dht
::
InfoHash
::
getRandom
();
}
void
dht_infohash_get
(
dht_infohash
*
h
,
const
uint8_t
*
dat
,
size_t
dat_size
)
{
*
reinterpret_cast
<
dht
::
InfoHash
*>
(
h
)
=
dht
::
InfoHash
::
get
(
dat
,
dat_size
);
}
bool
dht_infohash_is_zero
(
const
dht_infohash
*
h
)
{
return
static_cast
<
bool
>
(
*
reinterpret_cast
<
const
dht
::
InfoHash
*>
(
h
));
}
...
...
This diff is collapsed.
Click to expand it.
c/opendht_c.h
+
2
−
1
View file @
01bf8f93
...
...
@@ -37,6 +37,7 @@ struct OPENDHT_C_PUBLIC dht_infohash { uint8_t d[HASH_LEN]; };
typedef
struct
dht_infohash
dht_infohash
;
OPENDHT_C_PUBLIC
void
dht_infohash_zero
(
dht_infohash
*
h
);
OPENDHT_C_PUBLIC
void
dht_infohash_random
(
dht_infohash
*
h
);
OPENDHT_C_PUBLIC
void
dht_infohash_get
(
dht_infohash
*
h
,
const
uint8_t
*
dat
,
size_t
dat_size
);
OPENDHT_C_PUBLIC
const
char
*
dht_infohash_print
(
const
dht_infohash
*
h
);
OPENDHT_C_PUBLIC
bool
dht_infohash_is_zero
(
const
dht_infohash
*
h
);
...
...
@@ -63,7 +64,7 @@ typedef struct dht_privatekey dht_privatekey;
OPENDHT_C_PUBLIC
dht_privatekey
*
dht_privatekey_generate
(
unsigned
key_length_bits
);
OPENDHT_C_PUBLIC
dht_privatekey
*
dht_privatekey_import
(
const
uint8_t
*
dat
,
size_t
dat_size
,
const
char
*
password
);
OPENDHT_C_PUBLIC
dht_publickey
*
dht_privatekey_get_publickey
(
const
dht_privatekey
*
);
OPENDHT_C_PUBLIC
void
dht_privatekey_delete
(
dht_privatekey
*
pk
);
OPENDHT_C_PUBLIC
void
dht_privatekey_delete
(
dht_privatekey
*
);
// dht::crypto::Certificate
struct
OPENDHT_C_PUBLIC
dht_certificate
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment