private static Func <HashAlgorithm> GetHashAlgorithm(BlakeTypes type)
 {
     return(type switch
     {
         //BlakeTypes.Blake256 => () => new Blake256(),
         BlakeTypes.Blake512 => () => new Blake512()
     });
示例#2
0
 public static IBlake Create(BlakeTypes type, BlakeConfig config)
 {
     return(type switch
     {
         //BlakeTypes.Blake256 => new Blake1Function(config, BlakeTypes.Blake256),
         BlakeTypes.Blake512 => new Blake1Function(config, BlakeTypes.Blake512),
         BlakeTypes.Blake2S => new Blake2SFunction(config),
         BlakeTypes.Blake2B => new Blake2BFunction(config),
         _ => new Blake2BFunction(config)
     });
示例#3
0
 public static BlakeConfig Map(BlakeTypes type)
 {
     return(type switch
     {
         //BlakeTypes.Blake256 => new BlakeConfig {HashSizeInBits = 256},
         BlakeTypes.Blake512 => new BlakeConfig {
             HashSizeInBits = 512
         },
         BlakeTypes.Blake2S => new BlakeConfig {
             HashSizeInBits = 256
         },
         BlakeTypes.Blake2B => new BlakeConfig {
             HashSizeInBits = 512
         },
     });
示例#4
0
 public static IBlake Create(BlakeTypes type = BlakeTypes.Blake2B)
 {
     return(Create(type, BlakeTable.Map(type)));
 }
示例#5
0
 public static IBlake Create(BlakeTypes type, BlakeConfig config) => Factory.Create(type, config);
示例#6
0
 public static IBlake Create(BlakeTypes type = BlakeTypes.Blake2B) => Factory.Create(type);
 public BlockTransformer(BlakeConfig config, BlakeTypes type)
 {
     _type                     = type;
     _hashSizeInBits           = config.HashSizeInBits;
     _internalAlgorithmFactory = GetHashAlgorithm(_type);
 }
 public Blake1Function(BlakeConfig config, BlakeTypes type)
 {
     HashType = type;
     _config  = config;
 }