diff --git a/e2e/singleUse/mac.go b/e2e/singleUse/mac.go index 7a3de99fc41c65b7de152b6e61fc30e4883be02a..9b61361e3c235dad90cd675a4086fd3e82cdcc1e 100644 --- a/e2e/singleUse/mac.go +++ b/e2e/singleUse/mac.go @@ -9,13 +9,13 @@ package singleUse import ( "bytes" - "gitlab.com/elixxir/crypto/hash" "crypto/hmac" + "gitlab.com/elixxir/crypto/hash" ) const macSalt = "singleUseMacSalt" -// MakeMAC generates the MAC used in both the transmission and response CMIX +// MakeMAC generates the MAC used in both the transmission and response cMix // messages. func MakeMAC(key []byte, encryptedPayload []byte) []byte { h := hmac.New(hash.DefaultHash, key) diff --git a/e2e/singleUse/mac_test.go b/e2e/singleUse/mac_test.go index 20979ed45baf4eeb8670f0cf8ee197e687b87972..01f6a4838b6013d9d116543da3a53c34dbc1be7c 100644 --- a/e2e/singleUse/mac_test.go +++ b/e2e/singleUse/mac_test.go @@ -40,7 +40,7 @@ func TestMAC_Consistency(t *testing.T) { testMacBase64 := base64.StdEncoding.EncodeToString(testMAC) if expectedMac != testMacBase64 { - t.Errorf("MakeMAC() did not return the expected MAC (%d)."+ + t.Errorf("MakeMAC did not return the expected MAC (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedMac, testMacBase64) } } @@ -67,7 +67,8 @@ func TestMAC_Unique(t *testing.T) { testMACBase64 := base64.StdEncoding.EncodeToString(testMAC) if _, exists := MACs[testMACBase64]; exists { - t.Errorf("Generated MAC collides with previously generated MAC (%d, %d)."+ + t.Errorf("Generated MAC collides with previously generated "+ + "MAC (%d, %d)."+ "\ncurrent MAC: key: %+v encryptedPayload: %+v"+ "\npreviouse MAC: key: %+v encryptedPayload: %+v"+ "\nMAC: %s", i, j, @@ -94,7 +95,8 @@ func TestMAC_Unique(t *testing.T) { testMACBase64 := base64.StdEncoding.EncodeToString(testMAC) if _, exists := MACs[testMACBase64]; exists { - t.Errorf("Generated MAC collides with previously generated MAC (%d, %d)."+ + t.Errorf("Generated MAC collides with previously generated "+ + "MAC (%d, %d)."+ "\ncurrent MAC: key: %+v encryptedPayload: %+v"+ "\npreviouse MAC: key: %+v encryptedPayload: %+v"+ "\nMAC: %s", i, j, @@ -137,7 +139,7 @@ func TestVerifyMAC(t *testing.T) { receivedMac, _ := base64.StdEncoding.DecodeString(expected) if !VerifyMAC(key, encryptedPayload, receivedMac) { - t.Errorf("VerifyMAC() failed for a correct MAC (%d)."+ + t.Errorf("VerifyMAC failed for a correct MAC (%d)."+ "\nkey: %+v\nexpected: %s\nreceived: %s", i, key, expected, testMACBase64) } @@ -161,7 +163,7 @@ func TestVerifyMAC_InvalidMacError(t *testing.T) { expectedMACBase64 := base64.StdEncoding.EncodeToString(expectedMac) if VerifyMAC(key, encryptedPayload, expectedMac) { - t.Errorf("VerifyMAC() verified invalid MAC (%d)."+ + t.Errorf("VerifyMAC verified invalid MAC (%d)."+ "\nkey: %+v\nexpected: %s\nreceived: %s", i, key, expectedMACBase64, testMACBase64) } diff --git a/e2e/singleUse/recipientID.go b/e2e/singleUse/recipientID.go index b2ec0af3e8ba4767364a193e120f6d82232e9fe3..d679829df517f2761f740ae02e440465f882b803 100644 --- a/e2e/singleUse/recipientID.go +++ b/e2e/singleUse/recipientID.go @@ -22,8 +22,8 @@ func NewRecipientID(pubKey *cyclic.Int, unencryptedPayload []byte) *id.ID { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use "+ - "communication recipient ID: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "communication recipient ID: %+v", err) } // Hash the public key and unencrypted payload diff --git a/e2e/singleUse/recipientID_test.go b/e2e/singleUse/recipientID_test.go index 1e03a1dfc9608779027b265b1141b9ecc8768c9e..e7cf124e67e1fdfddd2cfafa0f0e531103f23e84 100644 --- a/e2e/singleUse/recipientID_test.go +++ b/e2e/singleUse/recipientID_test.go @@ -25,7 +25,8 @@ func TestNewRecipientID_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedRID := range expectedRIDs { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) unencryptedPayload := make([]byte, prng.Intn(500)) prng.Read(unencryptedPayload) @@ -33,12 +34,12 @@ func TestNewRecipientID_Consistency(t *testing.T) { testRID := NewRecipientID(pubKey, unencryptedPayload) if expectedRID != testRID.String() { - t.Errorf("NewRecipientID() did not return the expected ID (%d)."+ + t.Errorf("NewRecipientID did not return the expected ID (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedRID, testRID) } if testRID.GetType() != id.User { - t.Errorf("NewRecipientID() did not return expected ID type (%d)."+ + t.Errorf("NewRecipientID did not return expected ID type (%d)."+ "\nexpected: %s\nreceived: %s", i, id.User, testRID.GetType()) } } @@ -55,7 +56,8 @@ func TestNewRecipientID_Unique(t *testing.T) { // Test with same public key but differing payloads for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) for j := 0; j < testRuns; j++ { unencryptedPayload := make([]byte, prng.Intn(500)+j) @@ -64,12 +66,16 @@ func TestNewRecipientID_Unique(t *testing.T) { testID := NewRecipientID(pubKey, unencryptedPayload) if _, exists := IDs[testID]; exists { - t.Errorf("Generated ID collides with previously generated ID (%d, %d)."+ + t.Errorf("Generated ID collides with previously generated "+ + "ID (%d, %d)."+ "\ncurrent ID: key: %s unencryptedPayload: %+v"+ "\npreviouse ID: key: %s unencryptedPayload: %+v"+ "\nID: %s", i, j, - pubKey.Text(10), unencryptedPayload, IDs[testID].pubKey.Text(10), - IDs[testID].encryptedPayload, testID) + pubKey.Text(10), + unencryptedPayload, + IDs[testID].pubKey.Text(10), + IDs[testID].encryptedPayload, + testID) } else { IDs[testID] = struct { pubKey *cyclic.Int @@ -84,18 +90,23 @@ func TestNewRecipientID_Unique(t *testing.T) { unencryptedPayload := make([]byte, prng.Intn(500)+i) prng.Read(unencryptedPayload) for j := 0; j < testRuns; j++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) testID := NewRecipientID(pubKey, unencryptedPayload) if _, exists := IDs[testID]; exists { - t.Errorf("Generated ID collides with previously generated ID (%d, %d)."+ + t.Errorf("Generated ID collides with previously generated "+ + "ID (%d, %d)."+ "\ncurrent ID: key: %s unencryptedPayload: %+v"+ "\npreviouse ID: key: %s unencryptedPayload: %+v"+ "\nID: %s", i, j, - pubKey.Text(10), unencryptedPayload, IDs[testID].pubKey.Text(10), - IDs[testID].encryptedPayload, testID) + pubKey.Text(10), + unencryptedPayload, + IDs[testID].pubKey.Text(10), + IDs[testID].encryptedPayload, + testID) } else { IDs[testID] = struct { pubKey *cyclic.Int diff --git a/e2e/singleUse/responseFingerprint.go b/e2e/singleUse/responseFingerprint.go index 37f77266f9773d8c29cd3f76d73c1b47b6ecb53d..911b013eb417561711cf8e8b5986f9d7b5bbb6b2 100644 --- a/e2e/singleUse/responseFingerprint.go +++ b/e2e/singleUse/responseFingerprint.go @@ -23,8 +23,8 @@ func NewResponseFingerprint(dhKey *cyclic.Int, keyNum uint64) format.Fingerprint // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use response "+ - "fingerprint: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "response fingerprint: %+v", err) } keyNumBytes := make([]byte, binary.MaxVarintLen64) diff --git a/e2e/singleUse/responseFingerprint_test.go b/e2e/singleUse/responseFingerprint_test.go index 7db2f95d0705d8142c012d6e1bb9b2933168ab25..329b0da5feb845204d6a2d9bfd2a58bcea172e6b 100644 --- a/e2e/singleUse/responseFingerprint_test.go +++ b/e2e/singleUse/responseFingerprint_test.go @@ -33,7 +33,8 @@ func TestNewResponseFingerprint_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedFP := range expectedFPs { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) @@ -41,7 +42,7 @@ func TestNewResponseFingerprint_Consistency(t *testing.T) { testFpBase64 := base64.StdEncoding.EncodeToString(testFP[:]) if expectedFP != testFpBase64 { - t.Errorf("NewResponseFingerprint() did not return the expected "+ + t.Errorf("NewResponseFingerprint did not return the expected "+ "fingerprint (%d).\nexpected: %s\nreceived: %s", i, expectedFP, testFpBase64) } @@ -59,7 +60,8 @@ func TestNewResponseFingerprint_Unique(t *testing.T) { // Test with same DH key but differing key numbers for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) for j := 0; j < testRuns; j++ { @@ -85,7 +87,8 @@ func TestNewResponseFingerprint_Unique(t *testing.T) { // Test with same key numbers but differing DH keys for i := 0; i < testRuns; i++ { for j := 0; j < testRuns; j++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) testFP := NewResponseFingerprint(dhKey, uint64(i)) diff --git a/e2e/singleUse/responseKey.go b/e2e/singleUse/responseKey.go index b5ada4327670845424156f6659599b92da4c1e35..8f726da7070bf698301380aae3a0b6f7a9f206e1 100644 --- a/e2e/singleUse/responseKey.go +++ b/e2e/singleUse/responseKey.go @@ -22,8 +22,8 @@ func NewResponseKey(dhKey *cyclic.Int, keyNum uint64) []byte { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use response "+ - "key: %v", err) + jww.FATAL.Panicf( + "[SU] Failed to create new hash for single-use response key: %+v", err) } keyNumBytes := make([]byte, binary.MaxVarintLen64) diff --git a/e2e/singleUse/responseKey_test.go b/e2e/singleUse/responseKey_test.go index 5a981f979f5bd5f28bf84bea91333f62d45feca8..e691b2c8113329a4a262a6e96c17cec22a8fd7c7 100644 --- a/e2e/singleUse/responseKey_test.go +++ b/e2e/singleUse/responseKey_test.go @@ -32,7 +32,8 @@ func TestNewResponseKey_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedKey := range expectedKeys { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) @@ -40,7 +41,7 @@ func TestNewResponseKey_Consistency(t *testing.T) { testKeyBase64 := base64.StdEncoding.EncodeToString(testKey) if expectedKey != testKeyBase64 { - t.Errorf("NewResponseKey() did not return the expected key (%d)."+ + t.Errorf("NewResponseKey did not return the expected key (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedKey, testKeyBase64) } } @@ -57,7 +58,8 @@ func TestNewResponseKey_Unique(t *testing.T) { // Test with same DH key but differing key numbers for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+i, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) for j := 0; j < testRuns; j++ { @@ -84,7 +86,8 @@ func TestNewResponseKey_Unique(t *testing.T) { // Test with same key number but differing DH keys for i := 0; i < testRuns; i++ { for j := 0; j < testRuns; j++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength+j, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) testKey := NewResponseKey(dhKey, uint64(i)) diff --git a/e2e/singleUse/tagFingerprint.go b/e2e/singleUse/tagFingerprint.go index ac45059738f8baaf6348a4ea6bf973dcee3144dc..a5dad997fce770cad6cd8b6b1d76865f1c68fafe 100644 --- a/e2e/singleUse/tagFingerprint.go +++ b/e2e/singleUse/tagFingerprint.go @@ -25,8 +25,8 @@ func NewTagFP(tag string) TagFP { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use "+ - "communication tag fingerprint: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "communication tag fingerprint: %+v", err) } // Hash tag and salt diff --git a/e2e/singleUse/tagFingerprint_test.go b/e2e/singleUse/tagFingerprint_test.go index 7e6289b239d91b89707d18cb5024ddd661c3f87c..5fb029eefa9d6dfdb312323e0562dc7f5152dffb 100644 --- a/e2e/singleUse/tagFingerprint_test.go +++ b/e2e/singleUse/tagFingerprint_test.go @@ -37,7 +37,7 @@ func TestNewTagFP_Consistency(t *testing.T) { testFP := NewTagFP(string(tag)) if expectedFP != testFP.String() { - t.Errorf("NewTagFP() did not return the expected fingerprint (%d)."+ + t.Errorf("NewTagFP did not return the expected fingerprint (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedFP, testFP) } } @@ -74,14 +74,14 @@ func TestUnmarshalTagFP(t *testing.T) { fp := UnmarshalTagFP(fpBytes) if !bytes.Equal(fpBytes, fp[:]) { - t.Errorf("UnmarshalTagFP() failed to copy the correct bytes into the tag "+ - "fingerprint.\nexpected: %+v\nreceived: %+v", fpBytes, fp) + t.Errorf("UnmarshalTagFP failed to copy the correct bytes into the "+ + "tag fingerprint.\nexpected: %+v\nreceived: %+v", fpBytes, fp) } // Ensure that the data is copied fpBytes[2]++ if fp[2] == fpBytes[2] { - t.Errorf("UnmarshalTagFP() failed to create a copy of the data.") + t.Errorf("UnmarshalTagFP failed to create a copy of the data.") } } @@ -94,14 +94,14 @@ func TestTagFP_Bytes(t *testing.T) { fp := UnmarshalTagFP(fpBytes) testFpBytes := fp.Bytes() if !bytes.Equal(fpBytes, testFpBytes) { - t.Errorf("Bytes() failed to return the expected bytes."+ + t.Errorf("Bytes failed to return the expected bytes."+ "\nexpected: %+v\nreceived: %+v", fpBytes, testFpBytes) } // Ensure that the data is copied testFpBytes[2]++ if fp[2] == testFpBytes[2] { - t.Errorf("Bytes() failed to create a copy of the data.") + t.Errorf("Bytes failed to create a copy of the data.") } } @@ -114,7 +114,7 @@ func TestTagFP_String(t *testing.T) { expectedString := base64.StdEncoding.EncodeToString(fpBytes) if expectedString != fp.String() { - t.Errorf("String() failed to return the expected string."+ + t.Errorf("String failed to return the expected string."+ "\nexpected: %s\nreceived: %s", expectedString, fp.String()) } } diff --git a/e2e/singleUse/transmitFingerprint.go b/e2e/singleUse/transmitFingerprint.go index 3969e42d469844ef118dde46acd008991336cab8..856de645f813d57a74ed1f0f17aa8ca5ff2c1d88 100644 --- a/e2e/singleUse/transmitFingerprint.go +++ b/e2e/singleUse/transmitFingerprint.go @@ -22,8 +22,8 @@ func NewTransmitFingerprint(pubKey *cyclic.Int) format.Fingerprint { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use "+ - "transmission fingerprint: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "transmission fingerprint: %+v", err) } // Hash the public key and salt diff --git a/e2e/singleUse/transmitFingerprint_test.go b/e2e/singleUse/transmitFingerprint_test.go index 3d4676ea339cd556a3f5a2780f4e3c6682375db2..1525196befdb984de987e1de9bee19c82c7ea781 100644 --- a/e2e/singleUse/transmitFingerprint_test.go +++ b/e2e/singleUse/transmitFingerprint_test.go @@ -33,14 +33,15 @@ func TestNewTransmitFingerprint_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedFP := range expectedFPs { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) testFP := NewTransmitFingerprint(pubKey) testFpBase64 := base64.StdEncoding.EncodeToString(testFP[:]) if expectedFP != testFpBase64 { - t.Errorf("NewTransmitFingerprint() did not return the expected "+ + t.Errorf("NewTransmitFingerprint did not return the expected "+ "fingerprint (%d).\nexpected: %s\nreceived: %s", i, expectedFP, testFpBase64) } @@ -54,12 +55,13 @@ func TestNewTransmitFingerprint_Unique(t *testing.T) { FPs := make(map[format.Fingerprint]*cyclic.Int) for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) testFP := NewTransmitFingerprint(pubKey) if FPs[testFP] != nil { - t.Errorf("Generated fingerprint from key %s collides with "+ + t.Errorf("generated fingerprint from key %s collides with "+ "previously generated fingerprint from key %s."+ "\nfingerprint: %s", pubKey.Text(10), FPs[testFP].Text(10), testFP) diff --git a/e2e/singleUse/transmitKey.go b/e2e/singleUse/transmitKey.go index 038b75efe6a8dcfca8473ee4691c24072fe6c03f..d8516165072f7e3020f0f828c8ad038829f77f7b 100644 --- a/e2e/singleUse/transmitKey.go +++ b/e2e/singleUse/transmitKey.go @@ -20,8 +20,8 @@ func NewTransmitKey(dhKey *cyclic.Int) []byte { // Create new hash h, err := hash.NewCMixHash() if err != nil { - jww.ERROR.Panicf("Failed to create new hash for single-use "+ - "communication transmission key: %v", err) + jww.FATAL.Panicf("[SU] Failed to create new hash for single-use "+ + "communication transmission key: %+v", err) } // Hash the DH key and salt diff --git a/e2e/singleUse/transmitKey_test.go b/e2e/singleUse/transmitKey_test.go index 52f182a8ae8f1923447d5d7b2557649518396a38..d6c5b9df3da3a273a1e4e7eb5a4f857d88fd0ad5 100644 --- a/e2e/singleUse/transmitKey_test.go +++ b/e2e/singleUse/transmitKey_test.go @@ -32,7 +32,8 @@ func TestNewTransmitKey_Consistency(t *testing.T) { prng := rand.New(rand.NewSource(42)) for i, expectedKey := range expectedKeys { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp()) @@ -40,7 +41,7 @@ func TestNewTransmitKey_Consistency(t *testing.T) { testKeyBase64 := base64.StdEncoding.EncodeToString(testKey) if expectedKey != testKeyBase64 { - t.Errorf("NewTransmitKey() did not return the expected key (%d)."+ + t.Errorf("NewTransmitKey did not return the expected key (%d)."+ "\nexpected: %s\nreceived: %s", i, expectedKey, testKeyBase64) } } @@ -53,7 +54,8 @@ func TestNewTransmitKey_Unique(t *testing.T) { keys := make(map[string]*cyclic.Int, 100) for i := 0; i < testRuns; i++ { - privKey := diffieHellman.GeneratePrivateKey(diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) + privKey := diffieHellman.GeneratePrivateKey( + diffieHellman.DefaultPrivateKeyLength, getGrp(), prng) pubKey := diffieHellman.GeneratePublicKey(privKey, getGrp()) dhKey := diffieHellman.GenerateSessionKey(privKey, pubKey, getGrp())