Beispiel #1
0
 private static (int, uint, uint, bool, bool) Dict(MdTypes type)
 {
     return(type switch
     {
         MdTypes.Md2 => (128, 0, 0, false, false),
         MdTypes.Md4 => (128, 0, 0, false, false),
         MdTypes.Md5 => (128, 0, 0, false, false),
         MdTypes.Md5Bit16 => (64, 0, 0, false, false),
         MdTypes.Md5Bit32 => (128, 0, 0, false, false),
         MdTypes.Md5Bit64 => (192, 0, 0, false, false),
         MdTypes.Md6 => (256, 64, 0, false, false),
         MdTypes.Md6Bit128 => (128, 64, 0, false, false),
         MdTypes.Md6Bit256 => (256, 64, 0, false, false),
         MdTypes.Md6Bit512 => (512, 64, 0, false, false),
         MdTypes.Md6Custom => (256, 64, 0, true, true),
         _ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
     });
Beispiel #2
0
            public MdBlockTransformer(MdConfig config)
            {
                _hashSizeInBits = config.HashSizeInBits;
                _mdType         = config.Type;

                _worker = config.Type switch
                {
                    MdTypes.Md2 => _worker       = new Md2Worker(),
                    MdTypes.Md4 => _worker       = new Md4Worker(),
                    MdTypes.Md5 => _worker       = new Md5Worker(_mdType),
                    MdTypes.Md5Bit16 => _worker  = new Md5Worker(_mdType),
                    MdTypes.Md5Bit32 => _worker  = new Md5Worker(_mdType),
                    MdTypes.Md5Bit64 => _worker  = new Md5Worker(_mdType),
                    MdTypes.Md6 => _worker       = new Md6Worker(config),
                    MdTypes.Md6Bit128 => _worker = new Md6Worker(config),
                    MdTypes.Md6Bit256 => _worker = new Md6Worker(config),
                    MdTypes.Md6Bit512 => _worker = new Md6Worker(config),
                    MdTypes.Md6Custom => _worker = new Md6Worker(config),
                    _ => null
                };

                _trimOptions = config.GetTrimOptions();
            }
Beispiel #3
0
 /// <summary>
 /// 实例化对象
 /// <param name="mdType"></param>
 /// </summary>
 public MdTextLine(MdTypes mdType = MdTypes.TextLine) : base(mdType)
 {
     this.IsSection = false;
 }
Beispiel #4
0
 /// <summary>
 /// 对象实例化
 /// <param name="mdType"></param>
 /// <param name="lvString"></param>
 /// </summary>
 public MdBasicBlock(MdTypes mdType, string lvString = "") : base(mdType)
 {
     this.Children    = new MdBasicCollection(this);
     this.LevelString = lvString;
 }
Beispiel #5
0
 /// <summary>
 /// MD5 Worker
 /// </summary>
 /// <param name="type"></param>
 public Md5Worker(MdTypes type)
 {
     _type = type;
 }
Beispiel #6
0
 /// <summary>
 /// 对象实例化
 /// <param name="mdType"></param>
 /// </summary>
 public MdBasicContent(MdTypes mdType) : base(mdType)
 {
 }
Beispiel #7
0
 public static IMD Create(MdTypes type = MdTypes.Md5) => Factory.Create(type);
Beispiel #8
0
 internal MdFunction(MdTypes type)
 {
     HashType  = type;
     _mdConfig = MdTable.Map(type);
 }
Beispiel #9
0
 /// <summary>
 /// 对象实例化
 /// <param name="mdType"></param>
 /// </summary>
 public MdBasic(MdTypes mdType)
 {
     this.Type        = mdType;
     this.ParentBlock = null;
 }
Beispiel #10
0
 public static IMD Create(MdTypes type = MdTypes.Md5) => new MdFunction(type);