/// <summary> /// Generates the BIP checksum /// </summary> /// <param name="sdhFrame">The SDH frame.</param> /// <param name="block">The block.</param> /// <returns></returns> public static string GenerateBIP(IFrame sdhFrame, int blockCount) { FrameBuilder fmb = new FrameBuilder(); String checksum = String.Empty; byte[] bitFrame = BinaryInterleavedParity.ObjectToByteArray(fmb.BuildLiteral(sdhFrame)); int hopSize = bitFrame.Length / blockCount; for (int z = 0; z < blockCount; z++) { byte block = 0; for (int x = z; x < z * hopSize && x < bitFrame.Length; x++) { block = (byte)(block + bitFrame[x]); } block = (byte)(block % 2); checksum += block.ToString(); } return(checksum); }