Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
f0582053
Commit
f0582053
authored
Feb 12, 2014
by
Nick Mathewson
🐻
Browse files
csiphash: Add functions to take a global key.
parent
f51df9bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/ext/csiphash.c
View file @
f0582053
...
...
@@ -132,3 +132,17 @@ uint64_t siphash24(const void *src, unsigned long src_sz, const struct sipkey *k
return
(
v0
^
v1
)
^
(
v2
^
v3
);
}
static
int
the_siphash_key_is_set
=
0
;
static
struct
sipkey
the_siphash_key
;
uint64_t
siphash24g
(
const
void
*
src
,
unsigned
long
src_sz
)
{
return
siphash24
(
src
,
src_sz
,
&
the_siphash_key
);
}
void
siphash_set_global_key
(
const
struct
sipkey
*
key
)
{
the_siphash_key
.
k0
=
key
->
k0
;
the_siphash_key
.
k1
=
key
->
k1
;
the_siphash_key_is_set
=
1
;
}
src/ext/siphash.h
View file @
f0582053
...
...
@@ -6,4 +6,7 @@ struct sipkey {
};
uint64_t
siphash24
(
const
void
*
src
,
unsigned
long
src_sz
,
const
struct
sipkey
*
key
);
void
siphash_set_global_key
(
const
struct
sipkey
*
key
);
uint64_t
siphash24g
(
const
void
*
src
,
unsigned
long
src_sz
);
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment