/// <summary> /// This constructor regenerates a prior treehash object /// </summary> /// /// <param name="Digest">The hash function</param> /// <param name="StatByte">The status bytes</param> /// <param name="StatInt">The status ints</param> /// <param name="TreeH">The tree hash</param> /// <param name="NodeRet">The retained nodes</param> public GMSSRootCalc(IDigest Digest, byte[][] StatByte, int[] StatInt, Treehash[] TreeH, List <byte[]>[] NodeRet) { _msgDigestTree = Digest; // decode statInt _heightOfTree = StatInt[0]; _mdLength = StatInt[1]; m_K = StatInt[2]; _indexForNextSeed = StatInt[3]; _heightOfNextSeed = StatInt[4]; if (StatInt[5] == 1) { _isFinished = true; } else { _isFinished = false; } if (StatInt[6] == 1) { m_isInitialized = true; } else { m_isInitialized = false; } int tailLength = StatInt[7]; _ndeIndex = new int[_heightOfTree]; for (int i = 0; i < _heightOfTree; i++) { _ndeIndex[i] = StatInt[8 + i]; } _heightOfNodes = new List <int>(); for (int i = 0; i < tailLength; i++) { _heightOfNodes.Add(StatInt[8 + _heightOfTree + i]); } // decode statByte _treeRoot = StatByte[0]; _authPath = ArrayUtils.CreateJagged <byte[][]>(_heightOfTree, _mdLength); for (int i = 0; i < _heightOfTree; i++) { _authPath[i] = StatByte[1 + i]; } _tailStack = new List <byte[]>(); for (int i = 0; i < tailLength; i++) { _tailStack.Add(StatByte[1 + _heightOfTree + i]); } // decode treeH _treehash = GMSSUtil.Clone(TreeH); // decode ret _ndeRetain = GMSSUtil.Clone(NodeRet); }
/// <summary> /// Returns the initial treehash instances, storing value y_3(i) /// </summary> /// /// <returns>The initial treehash instances, storing value y_3(i)</returns> public Treehash[] GetTreehash() { return(GMSSUtil.Clone(_treehash)); }
/// <summary> /// Returns the retain stacks storing all right nodes near to the root /// </summary> /// /// <returns>The retain stacks storing all right nodes near to the root</returns> public List <byte[]>[] GetRetain() { return(GMSSUtil.Clone(_ndeRetain)); }
/// <summary> /// Returns the authentication path of the first leaf of the tree /// </summary> /// /// <returns>The authentication path of the first leaf of the tree</returns> public byte[][] GetAuthPath() { return(GMSSUtil.Clone(_authPath)); }