public void Test_Shamir_DivideStringSecret()
 {
     SecretSharingCore.Algorithms.Shamir shamir = new SecretSharingCore.Algorithms.Shamir();
     var n = 10;
     var k = 3;
     var secret = "1234567812345678123456781234567812345678123456781234567812345678";
     //assign
     var shares = shamir.DivideStringSecret(k, n, secret,(byte) 32);
     //assert
     Assert.AreEqual(shares.Count, n);
 }
Пример #2
0
        public void TestStringDivideSecret()
        {
            SecretSharingCore.Algorithms.Shamir shamir = new SecretSharingCore.Algorithms.Shamir();
            var n      = 10;
            var k      = 3;
            var secret = "1234567812345678123456781234567812345678123456781234567812345678";
            //assign
            var shares = shamir.DivideStringSecret(k, n, secret, (byte)32);

            //assert
            Assert.AreEqual(shares.Count, n);
        }
Пример #3
0
        public void TestStringReconstructSecret()
        {
            SecretSharingCore.Algorithms.Shamir shamir = new SecretSharingCore.Algorithms.Shamir();
            var n      = 5;
            var k      = 1;
            var secret = "12345678123456781234567812345678";    //12345678123456781234567812345678";
            //assign
            var shares      = shamir.DivideStringSecret(k, n, secret, (byte)16);
            var kShares     = shares.GetRange(0, k);
            var reconsecret = shamir.ReconstructStringSecret(kShares, (byte)16);

            //assert
            Assert.AreEqual(shares.Count, n);
            Assert.AreEqual(secret, reconsecret);
        }
 public void Test_Shamir_ReconstructStringSecret()
 {
     SecretSharingCore.Algorithms.Shamir shamir = new SecretSharingCore.Algorithms.Shamir();
         var n = 5;
         var k = 1;
         var secret = "12345678123456781234567812345678";//12345678123456781234567812345678";
         //assign
         var shares = shamir.DivideStringSecret(k, n, secret, (byte)16);
         var kShares = shares.GetRange(0, k);
         var reconsecret = shamir.ReconstructStringSecret(kShares, (byte)16);
         //assert
         Assert.AreEqual(shares.Count, n);
         Assert.AreEqual(secret, reconsecret);
 }