1

Resolved

SecretPhase - max length

description

It seems that the SecretPhase has a maximum length.

Consider the following test:

... c#
    [TestMethod()]
    public void TestLongSecretPhase()
    {
        SKGL.Generate gen = new SKGL.Generate();
        gen.secretPhase = "VeryLongSecretPhaseForGenerator";

        var validator = new SKGL.Validate();
        validator.secretPhase = "VeryLongSecretPhaseForValidator";

        validator.Key = gen.doKey(30);

        // validator should fail 
        Assert.IsTrue(validator.IsValid == false);

    }
...

comments

artemlos wrote Apr 26, 2015 at 6:59 PM

It does not work because the secretPhase is different. Please take a look at this code
                        SKGL.Generate gen = new SKGL.Generate();
                        gen.secretPhase = "VeryLongSecretPhaseForGenerator";

                        var validator = new SKGL.Validate();
                        validator.secretPhase = gen.secretPhase;

                        validator.Key = gen.doKey(30);

                        // validator should fail 
                        Assert.IsTrue(validator.IsValid == false);
Just to be on the safe side, I've tried to run this several thousand times (with the code below):
           Task[] tasks = new Task[100000];

            for (int i = 0; i < tasks.Length; i++)
            {
                tasks[i] = Task.Factory.StartNew(() =>
                    {
                        SKGL.Generate gen = new SKGL.Generate();
                        gen.secretPhase = "VeryLongSecretPhaseForGenerator";

                        var validator = new SKGL.Validate();
                        validator.secretPhase = gen.secretPhase;

                        validator.Key = gen.doKey(30);

                        // validator should fail 
                        Assert.IsTrue(validator.IsValid == false);
                    });
                
            }

            Task.WaitAll(tasks);
and did not get any assertion errors.

wrote Apr 26, 2015 at 7:00 PM