Rename and clean memory
MODIFY
WalletWasabi.Tests/UnitTests/Crypto/StrobeTests.cs
WalletWasabi.Tests/UnitTests/Crypto/StrobeTests.cs
@@ -22,32 +22,32 @@ namespace WalletWasabi.Tests.UnitTests.Crypto
var strobe1 = new Strobe128("TestProtocol.v0.0.1");
var strobe2 = new Strobe128("TestProtocol.v0.0.1");
- strobe1.AddMetaData(ToBytes("wabisabi://unitests/"), false);
- strobe1.AddMetaData(ToBytes("greeting/"), true);
- strobe1.AddData(ToBytes("hello"), false);
+ strobe1.AddAssociatedMetaData(ToBytes("wabisabi://unitests/"), false);
+ strobe1.AddAssociatedMetaData(ToBytes("greeting/"), true);
+ strobe1.AddAssociatedData(ToBytes("hello"), false);
- strobe2.AddMetaData(ToBytes("wabisabi://unitests/"), false);
- strobe2.AddMetaData(ToBytes("greeting/"), true);
- strobe2.AddData(ToBytes("hello"), false);
+ strobe2.AddAssociatedMetaData(ToBytes("wabisabi://unitests/"), false);
+ strobe2.AddAssociatedMetaData(ToBytes("greeting/"), true);
+ strobe2.AddAssociatedData(ToBytes("hello"), false);
- strobe1.AddMetaData(ToBytes("prf"), false);
+ strobe1.AddAssociatedMetaData(ToBytes("prf"), false);
var rnd1 = strobe1.Prf(12, false);
- strobe2.AddMetaData(ToBytes("prf"), false);
+ strobe2.AddAssociatedMetaData(ToBytes("prf"), false);
var rnd2 = strobe2.Prf(12, false);
Assert.Equal(rnd1, rnd2);
- strobe1.AddMetaData(ToBytes("key"), false);
+ strobe1.AddAssociatedMetaData(ToBytes("key"), false);
strobe1.Key(rnd1, false);
- strobe2.AddMetaData(ToBytes("key"), false);
+ strobe2.AddAssociatedMetaData(ToBytes("key"), false);
strobe2.Key(rnd2, false);
- strobe1.AddMetaData(ToBytes("prf"), false);
+ strobe1.AddAssociatedMetaData(ToBytes("prf"), false);
rnd1 = strobe1.Prf(12, false);
- strobe2.AddMetaData(ToBytes("prf"), false);
+ strobe2.AddAssociatedMetaData(ToBytes("prf"), false);
rnd2 = strobe2.Prf(12, false);
Assert.Equal(rnd1, rnd2);
@@ -56,7 +56,7 @@ namespace WalletWasabi.Tests.UnitTests.Crypto
Assert.Equal(strobe1.ToString(), strobe3.ToString());
- strobe1.AddData(ToBytes("Something"), false);
+ strobe1.AddAssociatedData(ToBytes("Something"), false);
Assert.NotEqual(strobe1.ToString(), strobe3.ToString());
}
@@ -78,11 +78,11 @@ namespace WalletWasabi.Tests.UnitTests.Crypto
case "AD":
if (operation.IsMeta)
{
- strobe.AddMetaData(ByteHelpers.FromHex(operation.InputData), false);
+ strobe.AddAssociatedMetaData(ByteHelpers.FromHex(operation.InputData), false);
}
else
{
- strobe.AddData(ByteHelpers.FromHex(operation.InputData), false);
+ strobe.AddAssociatedData(ByteHelpers.FromHex(operation.InputData), false);
}
break;
case "PRF":
@@ -98,6 +98,8 @@ namespace WalletWasabi.Tests.UnitTests.Crypto
{
var testVectorFile = File.ReadAllText("./UnitTests/Data/StrobeTestVectors.json");
var x = JsonConvert.DeserializeObject<TestVectorsContainer>(testVectorFile);
+
+ // return all test vectors except the one for streaming because it is not implemented.
foreach (var vector in x.TestVectors.Where(x => !x.Name.Contains("streaming")))
{
yield return new object[] { vector };
@@ -105,8 +107,6 @@ namespace WalletWasabi.Tests.UnitTests.Crypto
}
private static byte[] ToBytes(string s) => Encoding.UTF8.GetBytes(s);
- private static byte[] From(string s) => Encoding.UTF8.GetBytes(s);
-
}
public class TestVectorsContainer

Rename and clean memory