public static ulong[] ConfigB(Blake2BConfig config, Blake2BTreeConfig treeConfig) { bool isSequential = treeConfig == null; if (isSequential) { treeConfig = SequentialTreeConfig; } ulong[] rawConfig = new ulong[8]; rawConfig[0] |= (uint)config.OutputSize; if (config.Key != null) { rawConfig[0] |= (uint)config.Key.Length << 8; } rawConfig[0] |= (uint)treeConfig.FanOut << 16; rawConfig[0] |= (uint)treeConfig.MaxHeight << 24; rawConfig[0] |= (ulong)(uint)treeConfig.LeafSize << 32; rawConfig[2] |= (uint)treeConfig.IntermediateHashSize << 8; if (config.Salt != null) { rawConfig[4] = Blake2BCore.BytesToUInt64(config.Salt, 0); rawConfig[5] = Blake2BCore.BytesToUInt64(config.Salt, 8); } if (config.Personalization != null) { rawConfig[6] = Blake2BCore.BytesToUInt64(config.Personalization, 0); rawConfig[7] = Blake2BCore.BytesToUInt64(config.Personalization, 8); } return(rawConfig); }
public static ulong[] ConfigB(Blake2BConfig Config, Blake2BTreeConfig TreeConfig) { bool IsSequential = TreeConfig == null; if (IsSequential) { TreeConfig = Blake2Builder.SequentialTreeConfig; } ulong[] RawConfig = new ulong[8]; RawConfig[0] |= (uint)Config.OutputSize; if (Config.Key != null) { RawConfig[0] |= (uint)Config.Key.Length << 8; } RawConfig[0] |= (uint)TreeConfig.FanOut << 16; RawConfig[0] |= (uint)TreeConfig.MaxHeight << 24; RawConfig[0] |= (ulong)(uint)TreeConfig.LeafSize << 32; RawConfig[2] |= (uint)TreeConfig.IntermediateHashSize << 8; if (Config.Salt != null) { RawConfig[4] = Blake2BCore.BytesToUInt64(Config.Salt, 0); RawConfig[5] = Blake2BCore.BytesToUInt64(Config.Salt, 8); } if (Config.Personalization != null) { RawConfig[6] = Blake2BCore.BytesToUInt64(Config.Personalization, 0); RawConfig[7] = Blake2BCore.BytesToUInt64(Config.Personalization, 8); } return(RawConfig); }