Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Wim Lewis
nettle
Commits
1413ad98
Commit
1413ad98
authored
Mar 31, 2012
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New macro ROTL64, analogous to ROTL32.
parent
53aaca44
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
ChangeLog
ChangeLog
+5
-0
sha512-compress.c
sha512-compress.c
+5
-6
No files found.
ChangeLog
View file @
1413ad98
...
...
@@ -34,6 +34,11 @@
with complemented shift count.
(SHR): Deleted macro, use plain shift operator instead.
* sha512-compress.c (ROTR): Deleted macro, replaced by...
(ROTL64): ...new macro, with complemented shift count
(SHR): Deleted macro, use plain shift operator instead.
(S0, S1, s0, s1): Updated accordingly.
2012-03-30 Niels Möller <nisse@lysator.liu.se>
* nettle-internal.c (nettle_salsa20): Cipher struct for
...
...
sha512-compress.c
View file @
1413ad98
...
...
@@ -38,8 +38,7 @@
/* A block, treated as a sequence of 64-bit words. */
#define SHA512_DATA_LENGTH 16
#define ROTR(n,x) ((x)>>(n) | ((x)<<(64-(n))))
#define SHR(n,x) ((x)>>(n))
#define ROTL64(n,x) ((x)<<(n) | ((x)>>(64-(n))))
/* The SHA512 functions. The Choice function is the same as the SHA1
function f1, and the majority function is the same as the SHA1 f3
...
...
@@ -48,11 +47,11 @@
#define Choice(x,y,z) ( (z) ^ ( (x) & ( (y) ^ (z) ) ) )
#define Majority(x,y,z) ( ((x) & (y)) ^ ((z) & ((x) ^ (y))) )
#define S0(x) (ROT
R(28
,(x)) ^ ROT
R
(3
4
,(x)) ^ ROT
R(39
,(x)))
#define S1(x) (ROT
R(14
,(x)) ^ ROT
R(18
,(x)) ^ ROT
R(41
,(x)))
#define S0(x) (ROT
L64(36
,(x)) ^ ROT
L64
(3
0
,(x)) ^ ROT
L64(25
,(x)))
#define S1(x) (ROT
L64(50
,(x)) ^ ROT
L64(46
,(x)) ^ ROT
L64(23
,(x)))
#define s0(x) (ROT
R(1
,(x)) ^ ROT
R(8
,(x)) ^
SHR(7,(x)
))
#define s1(x) (ROT
R(19
,(x)) ^ ROT
R(61
,(x)) ^
SHR(6,(x)
))
#define s0(x) (ROT
L64(63
,(x)) ^ ROT
L64(56
,(x)) ^
((x) >> 7
))
#define s1(x) (ROT
L64(45
,(x)) ^ ROT
L64(3
,(x)) ^
((x) >> 6
))
/* The initial expanding function. The hash function is defined over
an 64-word expanded input array W, where the first 16 are copies of
...
...
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