Example #1
0
        public List <ChecksumType> End()
        {
            List <ChecksumType> chks = new List <ChecksumType>();

            ChecksumType chk;

            if (_enabled.HasFlag(EnableChecksum.All))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.adler32,
                    Value = _adler32Ctx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.Crc16))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.crc16,
                    Value = _crc16Ctx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.Crc32))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.crc32,
                    Value = _crc32Ctx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.Crc64))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.crc64,
                    Value = _crc64Ctx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.Md5))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.md5,
                    Value = _md5Ctx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.Sha1))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.sha1,
                    Value = _sha1Ctx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.Sha256))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.sha256,
                    Value = _sha256Ctx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.Sha384))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.sha384,
                    Value = _sha384Ctx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.Sha512))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.sha512,
                    Value = _sha512Ctx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.SpamSum))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.spamsum,
                    Value = _ssCtx.End()
                };

                chks.Add(chk);
            }

            if (_enabled.HasFlag(EnableChecksum.Fletcher16))
            {
                chk = new ChecksumType
                {
                    type  = ChecksumTypeType.fletcher16,
                    Value = _f16Ctx.End()
                };

                chks.Add(chk);
            }

            if (!_enabled.HasFlag(EnableChecksum.Fletcher32))
            {
                return(chks);
            }

            chk = new ChecksumType
            {
                type  = ChecksumTypeType.fletcher32,
                Value = _f32Ctx.End()
            };

            chks.Add(chk);

            return(chks);
        }
Example #2
0
        public List <ChecksumType> End()
        {
            List <ChecksumType> chks = new List <ChecksumType>();

            ChecksumType chk;

            if (enabled.HasFlag(EnableChecksum.All))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.adler32, Value = adler32Ctx.End()
                };
                chks.Add(chk);
            }

            if (enabled.HasFlag(EnableChecksum.Crc16))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.crc16, Value = crc16Ctx.End()
                };
                chks.Add(chk);
            }

            if (enabled.HasFlag(EnableChecksum.Crc32))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.crc32, Value = crc32Ctx.End()
                };
                chks.Add(chk);
            }

            if (enabled.HasFlag(EnableChecksum.Crc64))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.crc64, Value = crc64Ctx.End()
                };
                chks.Add(chk);
            }

            if (enabled.HasFlag(EnableChecksum.Md5))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.md5, Value = md5Ctx.End()
                };
                chks.Add(chk);
            }

            #if !NETSTANDARD2_0
            if (enabled.HasFlag(EnableChecksum.Ripemd160))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.ripemd160, Value = ripemd160Ctx.End()
                };
                chks.Add(chk);
            }
            #endif

            if (enabled.HasFlag(EnableChecksum.Sha1))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.sha1, Value = sha1Ctx.End()
                };
                chks.Add(chk);
            }

            if (enabled.HasFlag(EnableChecksum.Sha256))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.sha256, Value = sha256Ctx.End()
                };
                chks.Add(chk);
            }

            if (enabled.HasFlag(EnableChecksum.Sha384))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.sha384, Value = sha384Ctx.End()
                };
                chks.Add(chk);
            }

            if (enabled.HasFlag(EnableChecksum.Sha512))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.sha512, Value = sha512Ctx.End()
                };
                chks.Add(chk);
            }

            if (enabled.HasFlag(EnableChecksum.SpamSum))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.spamsum, Value = ssctx.End()
                };
                chks.Add(chk);
            }

            if (enabled.HasFlag(EnableChecksum.Fletcher16))
            {
                chk = new ChecksumType {
                    type = ChecksumTypeType.fletcher16, Value = f16Ctx.End()
                };
                chks.Add(chk);
            }

            if (!enabled.HasFlag(EnableChecksum.Fletcher32))
            {
                return(chks);
            }

            chk = new ChecksumType {
                type = ChecksumTypeType.fletcher32, Value = f32Ctx.End()
            };
            chks.Add(chk);

            return(chks);
        }