Fabcoin Core
0.16.2
P2P Digital Currency
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
src
cpp-ethereum
utils
libscrypt
slowequals.c
Go to the documentation of this file.
1
#include <string.h>
2
3
/* Implements a constant time version of strcmp()
4
* Will return 1 if a and b are equal, 0 if they are not */
5
int
slow_equals
(
const
char
*
a
,
const
char
*
b
)
6
{
7
size_t
lena, lenb,
diff
, i;
8
lena = strlen(a);
9
lenb = strlen(b);
10
diff = strlen(a) ^ strlen(b);
11
12
for
(i=0; i<lena && i<lenb; i++)
13
{
14
diff |= a[i] ^ b[i];
15
}
16
if
(diff == 0)
17
{
18
return
1;
19
}
20
else
21
{
22
return
0;
23
}
24
}
25
26
a
#define a(i)
b
#define b(i, j)
dev::diff
N diff(N const &_a, N const &_b)
Definition:
Common.h:212
slow_equals
int slow_equals(const char *a, const char *b)
Definition:
slowequals.c:5
Generated on Mon Oct 22 2018 15:15:30 for Fabcoin Core by
1.8.11