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
53aaca44
Commit
53aaca44
authored
Mar 31, 2012
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ROTL32 in the sha256 code.
parent
5e2cbd5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
ChangeLog
ChangeLog
+4
-0
sha256-compress.c
sha256-compress.c
+4
-7
No files found.
ChangeLog
View file @
53aaca44
...
...
@@ -30,6 +30,10 @@
* sha1-compress.c (ROTL): Deleted macro, use ROTL32 instead.
* sha256-compress.c (ROTR): Deleted macro. Replaced by ROTL32,
with complemented shift count.
(SHR): Deleted macro, use plain shift operator instead.
2012-03-30 Niels Möller <nisse@lysator.liu.se>
* nettle-internal.c (nettle_salsa20): Cipher struct for
...
...
sha256-compress.c
View file @
53aaca44
...
...
@@ -38,9 +38,6 @@
/* A block, treated as a sequence of 32-bit words. */
#define SHA256_DATA_LENGTH 16
#define ROTR(n,x) ((x)>>(n) | ((x)<<(32-(n))))
#define SHR(n,x) ((x)>>(n))
/* The SHA256 functions. The Choice function is the same as the SHA1
function f1, and the majority function is the same as the SHA1 f3
function. They can be optimized to save one boolean operation each
...
...
@@ -52,11 +49,11 @@
/* #define Majority(x,y,z) ( ((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)) ) */
#define Majority(x,y,z) ( ((x) & (y)) ^ ((z) & ((x) ^ (y))) )
#define S0(x) (ROT
R(2
,(x)) ^ ROT
R
(1
3
,(x)) ^ ROT
R(22
,(x)))
#define S1(x) (ROT
R(
6,(x)) ^ ROT
R(1
1,(x)) ^ ROT
R(25
,(x)))
#define S0(x) (ROT
L32(30
,(x)) ^ ROT
L32
(1
9
,(x)) ^ ROT
L32(10
,(x)))
#define S1(x) (ROT
L32(2
6,(x)) ^ ROT
L32(2
1,(x)) ^ ROT
L32(7
,(x)))
#define s0(x) (ROT
R(7
,(x)) ^ ROT
R
(1
8
,(x)) ^
SHR(3,(x)
))
#define s1(x) (ROT
R
(1
7
,(x)) ^ ROT
R
(1
9
,(x)) ^
SHR(10,(x)
))
#define s0(x) (ROT
L32(25
,(x)) ^ ROT
L32
(1
4
,(x)) ^
((x) >> 3
))
#define s1(x) (ROT
L32
(1
5
,(x)) ^ ROT
L32
(1
3
,(x)) ^
((x) >> 10
))
/* The initial expanding function. The hash function is defined over an
64-word expanded input array W, where the first 16 are copies of the input
...
...
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