Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
42c667b3
Commit
42c667b3
authored
Jan 25, 2013
by
Ulrik Sverdrup
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
siphash: Use uint64_t directly, remove typedef
parent
dd000c9a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
ccan/siphash/siphash.c
ccan/siphash/siphash.c
+13
-15
No files found.
ccan/siphash/siphash.c
View file @
42c667b3
...
...
@@ -6,8 +6,6 @@
#include "siphash.h"
typedef
uint64_t
u64
;
enum
sip_index
{
A
=
0
,
B
=
2
,
C
=
1
,
D
=
3
,
E
=
4
};
#define rol(x,l) (((x) << (l)) | ((x) >> (64-(l))))
...
...
@@ -26,14 +24,14 @@ enum sip_index { A=0, B=2, C=1, D=3, E=4 };
} while(0)
static
inline
u
64
W64
(
const
unsigned
char
*
p
,
size_t
j
)
static
inline
u
int64_t
W64
(
const
unsigned
char
*
p
,
size_t
j
)
{
uint64_t
x
;
memcpy
(
&
x
,
p
+
j
*
sizeof
(
x
),
sizeof
(
x
));
return
le64_to_cpu
(
x
);
}
static
void
siphash_init
(
u
64
v
[
5
],
const
unsigned
char
key
[
16
])
static
void
siphash_init
(
u
int64_t
v
[
5
],
const
unsigned
char
key
[
16
])
{
v
[
A
]
=
W64
(
key
,
0
)
^
UINT64_C
(
0x736f6d6570736575
);
v
[
B
]
=
W64
(
key
,
1
)
^
UINT64_C
(
0x646f72616e646f6d
);
...
...
@@ -43,25 +41,25 @@ static void siphash_init(u64 v[5], const unsigned char key[16])
}
/* Load the last 0-7 bytes of `in` and put in len & 255 */
static
void
siphash_epilogue
(
u
64
*
m
,
const
unsigned
char
*
in
,
size_t
len
)
static
void
siphash_epilogue
(
u
int64_t
*
m
,
const
unsigned
char
*
in
,
size_t
len
)
{
in
+=
len
&
~
(
size_t
)
7
;
*
m
=
(
u
64
)(
len
&
255
)
<<
56
;
*
m
=
(
u
int64_t
)(
len
&
255
)
<<
56
;
switch
(
len
&
7
)
{
case
7
:
*
m
|=
(
u
64
)
in
[
6
]
<<
48
;
case
6
:
*
m
|=
(
u
64
)
in
[
5
]
<<
40
;
case
5
:
*
m
|=
(
u
64
)
in
[
4
]
<<
32
;
case
4
:
*
m
|=
(
u
64
)
in
[
3
]
<<
24
;
case
3
:
*
m
|=
(
u
64
)
in
[
2
]
<<
16
;
case
2
:
*
m
|=
(
u
64
)
in
[
1
]
<<
8
;
case
1
:
*
m
|=
(
u
64
)
in
[
0
];
case
7
:
*
m
|=
(
u
int64_t
)
in
[
6
]
<<
48
;
case
6
:
*
m
|=
(
u
int64_t
)
in
[
5
]
<<
40
;
case
5
:
*
m
|=
(
u
int64_t
)
in
[
4
]
<<
32
;
case
4
:
*
m
|=
(
u
int64_t
)
in
[
3
]
<<
24
;
case
3
:
*
m
|=
(
u
int64_t
)
in
[
2
]
<<
16
;
case
2
:
*
m
|=
(
u
int64_t
)
in
[
1
]
<<
8
;
case
1
:
*
m
|=
(
u
int64_t
)
in
[
0
];
case
0
:
;
}
}
u
64
siphash_2_4
(
const
void
*
in
,
size_t
len
,
const
unsigned
char
key
[
16
])
u
int64_t
siphash_2_4
(
const
void
*
in
,
size_t
len
,
const
unsigned
char
key
[
16
])
{
u
64
v
[
5
];
u
int64_t
v
[
5
];
size_t
j
;
siphash_init
(
v
,
key
);
...
...
Write
Preview
Markdown
is supported
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