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) });
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(); }
/// <summary> /// 实例化对象 /// <param name="mdType"></param> /// </summary> public MdTextLine(MdTypes mdType = MdTypes.TextLine) : base(mdType) { this.IsSection = false; }
/// <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; }
/// <summary> /// MD5 Worker /// </summary> /// <param name="type"></param> public Md5Worker(MdTypes type) { _type = type; }
/// <summary> /// 对象实例化 /// <param name="mdType"></param> /// </summary> public MdBasicContent(MdTypes mdType) : base(mdType) { }
public static IMD Create(MdTypes type = MdTypes.Md5) => Factory.Create(type);
internal MdFunction(MdTypes type) { HashType = type; _mdConfig = MdTable.Map(type); }
/// <summary> /// 对象实例化 /// <param name="mdType"></param> /// </summary> public MdBasic(MdTypes mdType) { this.Type = mdType; this.ParentBlock = null; }
public static IMD Create(MdTypes type = MdTypes.Md5) => new MdFunction(type);