Example #1
0
    public Session(SessionParameters sessionParameter, TransmissionWord transmissionWord, int currentRoundIndex)
    {
        bool validCurrentRoundIndex = currentRoundIndex >= 0 && currentRoundIndex < sessionParameter.RoundCount;

        Debug.Assert(validCurrentRoundIndex, string.Format("Tried to construct a session with invalid currentRoundIndex {0}", currentRoundIndex));
        if (!validCurrentRoundIndex)
        {
            return;
        }

        m_sessionParameter = sessionParameter;
        m_TransmissionWord = transmissionWord;

        m_SyllableChoiceArray = new ICryptoSyllable[sessionParameter.SyllableChoiceAmount];
        m_SyllableSearchArray = new ICryptoSyllable[sessionParameter.SyllableSearchedAmount];

        // Create transmission flow from parameter
        SessionParameters sp = m_sessionParameter;

        m_TransmissionSetup = TransmissionManager.BuildTransmissionSetup(sp.Seed, sp.RoundCount, sp.SyllableSearchedAmount, sp.SyllableChoiceAmount);

        // Set the active round index to the first entry
        ActiveRoundIndex = currentRoundIndex;

        // Start the first round
        SetRound(ActiveRoundIndex);
    }
Example #2
0
    public Session(SessionParameters sessionParameter)
    {
        m_sessionParameter = sessionParameter;

        m_SyllableChoiceArray = new ICryptoSyllable[sessionParameter.SyllableChoiceAmount];
        m_SyllableSearchArray = new ICryptoSyllable[sessionParameter.SyllableSearchedAmount];

        // Create transmission flow from parameter
        SessionParameters sp = m_sessionParameter;

        m_TransmissionSetup = TransmissionManager.BuildTransmissionSetup(sp.Seed, sp.RoundCount, sp.SyllableSearchedAmount, sp.SyllableChoiceAmount);

        m_TransmissionWord = new TransmissionWord(m_TransmissionSetup.StartWord);

        Debug.Assert(m_TransmissionSetup.Transmissions.Length == sp.RoundCount, "Transmission setup creation returned tansmission array with wrong length");

        // Set the active round index to the first entry
        ActiveRoundIndex = 0;

        // Start the first round
        SetRound(ActiveRoundIndex);
    }