Skip to content

Commit c7927e3

Browse files
authored
Merge pull request #12 from jakobnissen/add_used
Bugfix: Add used field to MD5 hash state
2 parents 6c8084a + 6b0d6f7 commit c7927e3

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

.github/workflows/UnitTests.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Unit tests
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
test:
9+
runs-on: ${{ matrix.os }}
10+
continue-on-error: ${{ matrix.experimental }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
julia-version:
15+
- '1.8'
16+
- '1'
17+
julia-arch: [x86]
18+
os: [ubuntu-latest, windows-latest, macOS-latest]
19+
experimental: [false]
20+
include:
21+
- julia-version: nightly
22+
julia-arch: x86
23+
os: ubuntu-latest
24+
experimental: true
25+
26+
steps:
27+
- name: Checkout Repository
28+
uses: actions/checkout@v2
29+
- name: Setup Julia
30+
uses: julia-actions/setup-julia@v1
31+
with:
32+
version: ${{ matrix.julia-version }}
33+
- name: Run Tests
34+
uses: julia-actions/julia-runtest@latest

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "MD5"
22
uuid = "6ac74813-4b46-53a4-afec-0b5dc9d7885c"
3-
version = "0.2.1"
3+
version = "0.2.2"
44

55
[deps]
66
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

src/types.jl

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@ mutable struct MD5_CTX <: SHA_CTX
22
state::Array{UInt32,1}
33
bytecount::UInt64
44
buffer::Array{UInt8,1}
5+
used::Bool
56
end
67

78
digestlen(::Type{MD5_CTX}) = 16
89
state_type(::Type{MD5_CTX}) = UInt32
910
# blocklen is the number of bytes of data processed by the transform!() function at once
1011
blocklen(::Type{MD5_CTX}) = UInt64(64)
1112

12-
13-
14-
15-
MD5_CTX() = MD5_CTX(copy(MD5_initial_hash_value), 0, zeros(UInt8, blocklen(MD5_CTX)))
13+
MD5_CTX() = MD5_CTX(copy(MD5_initial_hash_value), 0, zeros(UInt8, blocklen(MD5_CTX)), false)
1614
Base.copy(ctx::T) where {T<:MD5_CTX} = T(copy(ctx.state), ctx.bytecount, copy(ctx.buffer))
1715
Base.show(io::IO, ::MD5_CTX) = write(io, "MD5 hash state")
18-

0 commit comments

Comments
 (0)