Skip to content

Commit 6b48604

Browse files
committed
2.0.2 - Performance
1 parent 6eaa78c commit 6b48604

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22

33

4+
#### 2.0.2
5+
6+
Another performance bump.
7+
8+
49
#### 2.0.1
510

611
Major performance improvements.

elm.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "icidasset/elm-sha",
44
"summary": "SHA cryptographic hash functions.",
55
"license": "MIT",
6-
"version": "2.0.1",
6+
"version": "2.0.2",
77
"exposed-modules": [
88
"SHA"
99
],

src/SHA/Internal/Common.elm

+3-9
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,18 @@ combine : Int -> Bits -> Bits -> Bits
4848
combine sizeInBits x y =
4949
let
5050
sum =
51-
Binary.dropLeadingZeros (Binary.add x y)
51+
Binary.add x y
5252

5353
width =
5454
Binary.width sum
5555
in
5656
if width > sizeInBits then
57-
let
58-
excess =
59-
width - sizeInBits
60-
in
6157
-- Is the sum larger than the modulo constant (ie. 2 ^ sizeInBits)?
6258
sum
6359
|> Binary.toBooleans
64-
|> List.drop excess
60+
|> List.drop (width - sizeInBits)
6561
|> Binary.fromBooleans
66-
|> Binary.dropLeadingZeros
67-
|> Binary.ensureSize sizeInBits
6862

6963
else
7064
-- If not, carry on.
71-
Binary.ensureSize sizeInBits sum
65+
sum

0 commit comments

Comments
 (0)