Skip to content

Commit

Permalink
Remove extra spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
musm authored Aug 17, 2017
1 parent 90e1dff commit 1cca628
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/base_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ rrot(b,x,width) = ((x >> b) | (x << (width - b)))
lrot(b,x,width) = ((x << b) | (x >> (width - b)))

# Shift-right (used in SHA-256, SHA-384, and SHA-512):
R(b,x) = (x >> b)
R(b,x) = (x >> b)
# 32-bit Rotate-right (used in SHA-256):
S32(b,x) = rrot(b,x,32)
S32(b,x) = rrot(b,x,32)
# 64-bit Rotate-right (used in SHA-384 and SHA-512):
S64(b,x) = rrot(b,x,64)
S64(b,x) = rrot(b,x,64)
# 64-bit Rotate-left (used in SHA3)
L64(b,x) = lrot(b,x,64)
L64(b,x) = lrot(b,x,64)

# Two of six logical functions used in SHA-256, SHA-384, and SHA-512:
Ch(x,y,z) = ((x & y) (~x & z))
Maj(x,y,z) = ((x & y) (x & z) (y & z))

# Four of six logical functions used in SHA-256:
Sigma0_256(x) = (S32(2, UInt32(x)) S32(13, UInt32(x)) S32(22, UInt32(x)))
Sigma1_256(x) = (S32(6, UInt32(x)) S32(11, UInt32(x)) S32(25, UInt32(x)))
sigma0_256(x) = (S32(7, UInt32(x)) S32(18, UInt32(x)) R(3 , UInt32(x)))
sigma1_256(x) = (S32(17, UInt32(x)) S32(19, UInt32(x)) R(10, UInt32(x)))
Sigma0_256(x) = (S32(2, UInt32(x)) S32(13, UInt32(x)) S32(22, UInt32(x)))
Sigma1_256(x) = (S32(6, UInt32(x)) S32(11, UInt32(x)) S32(25, UInt32(x)))
sigma0_256(x) = (S32(7, UInt32(x)) S32(18, UInt32(x)) R(3 , UInt32(x)))
sigma1_256(x) = (S32(17, UInt32(x)) S32(19, UInt32(x)) R(10, UInt32(x)))

# Four of six logical functions used in SHA-384 and SHA-512:
Sigma0_512(x) = (S64(28, UInt64(x)) S64(34, UInt64(x)) S64(39, UInt64(x)))
Sigma1_512(x) = (S64(14, UInt64(x)) S64(18, UInt64(x)) S64(41, UInt64(x)))
sigma0_512(x) = (S64( 1, UInt64(x)) S64( 8, UInt64(x)) R( 7, UInt64(x)))
sigma1_512(x) = (S64(19, UInt64(x)) S64(61, UInt64(x)) R( 6, UInt64(x)))
Sigma0_512(x) = (S64(28, UInt64(x)) S64(34, UInt64(x)) S64(39, UInt64(x)))
Sigma1_512(x) = (S64(14, UInt64(x)) S64(18, UInt64(x)) S64(41, UInt64(x)))
sigma0_512(x) = (S64( 1, UInt64(x)) S64( 8, UInt64(x)) R( 7, UInt64(x)))
sigma1_512(x) = (S64(19, UInt64(x)) S64(61, UInt64(x)) R( 6, UInt64(x)))

# Let's be able to bswap arrays of these types as well
bswap!(x::Vector{<:Integer}) = map!(bswap, x, x)

0 comments on commit 1cca628

Please sign in to comment.