Skip to content

Commit

Permalink
Merge pull request #12 from jakobnissen/add_used
Browse files Browse the repository at this point in the history
Bugfix: Add used field to MD5 hash state
  • Loading branch information
jw3126 authored Oct 13, 2023
2 parents 6c8084a + 6b0d6f7 commit c7927e3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/UnitTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Unit tests

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
julia-version:
- '1.8'
- '1'
julia-arch: [x86]
os: [ubuntu-latest, windows-latest, macOS-latest]
experimental: [false]
include:
- julia-version: nightly
julia-arch: x86
os: ubuntu-latest
experimental: true

steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Julia
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- name: Run Tests
uses: julia-actions/julia-runtest@latest
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "MD5"
uuid = "6ac74813-4b46-53a4-afec-0b5dc9d7885c"
version = "0.2.1"
version = "0.2.2"

[deps]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
7 changes: 2 additions & 5 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ mutable struct MD5_CTX <: SHA_CTX
state::Array{UInt32,1}
bytecount::UInt64
buffer::Array{UInt8,1}
used::Bool
end

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




MD5_CTX() = MD5_CTX(copy(MD5_initial_hash_value), 0, zeros(UInt8, blocklen(MD5_CTX)))
MD5_CTX() = MD5_CTX(copy(MD5_initial_hash_value), 0, zeros(UInt8, blocklen(MD5_CTX)), false)
Base.copy(ctx::T) where {T<:MD5_CTX} = T(copy(ctx.state), ctx.bytecount, copy(ctx.buffer))
Base.show(io::IO, ::MD5_CTX) = write(io, "MD5 hash state")

2 comments on commit c7927e3

@jw3126
Copy link
Collaborator Author

@jw3126 jw3126 commented on c7927e3 Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/93586

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.2 -m "<description of version>" c7927e301dd9d7c8710617d31cecd2095e86dd92
git push origin v0.2.2

Please sign in to comment.