Ejemplo n.º 1
0
 private static Func <HashAlgorithm> GetHashAlgorithm(BlakeTypes type)
 {
     return(type switch
     {
         //BlakeTypes.Blake256 => () => new Blake256(),
         BlakeTypes.Blake512 => () => new Blake512()
     });
Ejemplo n.º 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)
     });
Ejemplo n.º 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
         },
     });
Ejemplo n.º 4
0
 public static IBlake Create(BlakeTypes type = BlakeTypes.Blake2B)
 {
     return(Create(type, BlakeTable.Map(type)));
 }
Ejemplo n.º 5
0
 public static IBlake Create(BlakeTypes type, BlakeConfig config) => Factory.Create(type, config);
Ejemplo n.º 6
0
 public static IBlake Create(BlakeTypes type = BlakeTypes.Blake2B) => Factory.Create(type);
Ejemplo n.º 7
0
 public BlockTransformer(BlakeConfig config, BlakeTypes type)
 {
     _type                     = type;
     _hashSizeInBits           = config.HashSizeInBits;
     _internalAlgorithmFactory = GetHashAlgorithm(_type);
 }
Ejemplo n.º 8
0
 public Blake1Function(BlakeConfig config, BlakeTypes type)
 {
     HashType = type;
     _config  = config;
 }