-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
69 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ os: | |
- linux | ||
- osx | ||
julia: | ||
- 0.6 | ||
- 0.7 | ||
- 1.0 | ||
- nightly | ||
notifications: | ||
email: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
julia 0.6 | ||
SHA 0.5.3 | ||
julia 0.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,42 @@ | ||
import Nettle | ||
# redundant imports, so this file can be run standalone | ||
using Base.Test | ||
using Test | ||
import MD5 | ||
using Random | ||
|
||
try | ||
import Nettle | ||
|
||
function test_equal_state(md5_value::MD5.MD5_CTX,nettle_value::Nettle.Hasher) | ||
@test nettle_value.state[1:16] == | ||
reinterpret(UInt8, md5_value.state) | ||
end | ||
|
||
@testset "Against Nettle initialize, update!, digest!" begin | ||
for _ in 1:10, chunkcount in [0,1,2,3, 10, 100] | ||
md5_value = MD5.MD5_CTX() | ||
nettle_value = Nettle.Hasher("md5") | ||
test_equal_state(md5_value, nettle_value) | ||
for _ in 1:chunkcount | ||
chunksize = rand(0:10000) | ||
data = rand(UInt8, chunksize) | ||
MD5.update!(md5_value, data) | ||
Nettle.update!(nettle_value, data) | ||
test_equal_state(md5_value,nettle_value) | ||
function test_equal_state(md5_value::MD5.MD5_CTX,nettle_value::Nettle.Hasher) | ||
@test nettle_value.state[1:16] == | ||
reinterpret(UInt8, md5_value.state) | ||
end | ||
|
||
@testset "Against Nettle initialize, update!, digest!" begin | ||
for _ in 1:10, chunkcount in [0,1,2,3, 10, 100] | ||
md5_value = MD5.MD5_CTX() | ||
nettle_value = Nettle.Hasher("md5") | ||
test_equal_state(md5_value, nettle_value) | ||
for _ in 1:chunkcount | ||
chunksize = rand(0:10000) | ||
data = rand(UInt8, chunksize) | ||
MD5.update!(md5_value, data) | ||
Nettle.update!(nettle_value, data) | ||
test_equal_state(md5_value,nettle_value) | ||
end | ||
@test MD5.digest!(md5_value) == Nettle.digest!(nettle_value) | ||
end | ||
@test MD5.digest!(md5_value) == Nettle.digest!(nettle_value) | ||
end | ||
end | ||
|
||
@testset "Against Nettle end to end" begin | ||
for offset in [0,10^3, 10^4, 10^5] | ||
iter = offset:(offset+1000) | ||
for l in iter | ||
s = randstring(l) | ||
@test Nettle.hexdigest("md5", s) == bytes2hex(md5(s)) | ||
@testset "Against Nettle end to end" begin | ||
for offset in [0,10^3, 10^4, 10^5] | ||
iter = offset:(offset+1000) | ||
for l in iter | ||
s = randstring(l) | ||
@test Nettle.hexdigest("md5", s) == bytes2hex(md5(s)) | ||
end | ||
end | ||
end | ||
catch err | ||
@warn "Cross checking again Nettle could not run, due to error" exception=err | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters