Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
crypto
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
crypto
Commits
ec8d5602
Commit
ec8d5602
authored
Apr 15, 2022
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
add unit test of generation of connection fingerprints
parent
7de5e3cd
No related branches found
No related tags found
2 merge requests
!65
Updates for Channel Support
,
!37
Restructure
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
e2e/connectionFingerprint_test.go
+31
-0
31 additions, 0 deletions
e2e/connectionFingerprint_test.go
with
31 additions
and
0 deletions
e2e/connectionFingerprint_test.go
0 → 100644
+
31
−
0
View file @
ec8d5602
package
e2e
import
(
"bytes"
"golang.org/x/crypto/blake2b"
"testing"
)
// Unit test of GenerateConnectionFingerprint.
func
TestGenerateConnectionFingerprint
(
t
*
testing
.
T
)
{
receiveFp
:=
[]
byte
{
5
}
sendFp
:=
[]
byte
{
10
}
h
,
_
:=
blake2b
.
New256
(
nil
)
h
.
Write
(
append
(
receiveFp
,
sendFp
...
))
expected
:=
h
.
Sum
(
nil
)
fp
:=
GenerateConnectionFingerprint
(
sendFp
,
receiveFp
)
if
!
bytes
.
Equal
(
fp
,
expected
)
{
t
.
Errorf
(
"ConnectionFingerprint did not return the expected "
+
"fingerprint.
\n
expected: %s
\n
received: %s"
,
expected
,
fp
)
}
// Flip the order and show that the output is the same.
receiveFp
,
sendFp
=
sendFp
,
receiveFp
fp
=
GenerateConnectionFingerprint
(
sendFp
,
receiveFp
)
if
!
bytes
.
Equal
(
fp
,
expected
)
{
t
.
Errorf
(
"ConnectionFingerprint did not return the expected "
+
"fingerprint.
\n
expected: %s
\n
received: %s"
,
expected
,
fp
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment