/// <remarks> /// Default generation function /// </remarks> private void GenerateConfiguration() { Threefish512 cipher = new Threefish512(); UbiTweak tweak = new UbiTweak(); // initialize the tweak value tweak.StartNewBlockType(UbiType.Config); tweak.IsFinalBlock = true; tweak.BitsProcessed = 32; cipher.SetTweak(tweak.Tweak); cipher.Encrypt(m_configString, m_configValue); m_configValue[0] ^= m_configString[0]; m_configValue[1] ^= m_configString[1]; m_configValue[2] ^= m_configString[2]; }
/// <remarks> /// Default generation function /// </remarks> private void GenerateConfiguration() { var cipher = new Threefish256(); var tweak = new UbiTweak(); // Initialize the tweak value tweak.StartNewBlockType(UbiType.Config); tweak.IsFinalBlock = true; tweak.BitsProcessed = 32; cipher.SetTweak(tweak.Tweak); cipher.Encrypt(ConfigString, ConfigValue); ConfigValue[0] ^= ConfigString[0]; ConfigValue[1] ^= ConfigString[1]; ConfigValue[2] ^= ConfigString[2]; }
/// <summary> /// Initializes the Skein hash instance /// </summary> /// /// <param name="InitializationType">Digest initialization type <see cref="SkeinInitializationType"/></param> public Skein512(SkeinInitializationType InitializationType = SkeinInitializationType.Normal) { m_initializationType = InitializationType; m_blockCipher = new Threefish512(); // allocate buffers m_inputBuffer = new byte[STATE_BYTES]; m_cipherInput = new ulong[STATE_WORDS]; m_digestState = new ulong[STATE_WORDS]; // allocate tweak m_ubiParameters = new UbiTweak(); // allocate config value m_configValue = new ulong[STATE_BYTES]; // initialize and enerate the configuration string m_configString = new ulong[STATE_BYTES]; m_configString[1] = (ulong)DigestSize * 8; SetSchema(83, 72, 65, 51); // "SHA3" SetVersion(1); GenerateConfiguration(); Initialize(InitializationType); }
/// <summary> /// Initializes the Skein hash instance. /// </summary> /// /// <param name="InitializationType">Digest initialization type <see cref="SkeinInitializationType"/></param> public Skein256(SkeinInitializationType InitializationType = SkeinInitializationType.Normal) { this.InitializationType = InitializationType; _cipherStateBits = STATE_SIZE; _cipherStateBytes = STATE_SIZE / 8; _cipherStateWords = STATE_SIZE / 64; _outputBytes = (STATE_SIZE + 7) / 8; _blockCipher = new Threefish256(); // Allocate buffers _inputBuffer = new byte[_cipherStateBytes]; _cipherInput = new UInt64[_cipherStateWords]; _digestState = new UInt64[_cipherStateWords]; // Allocate tweak UbiParameters = new UbiTweak(); // Generate the configuration string SkeinConfig(); SetSchema(83, 72, 65, 51); // "SHA3" SetVersion(1); GenerateConfiguration(); Initialize(InitializationType); }
/// <remarks> /// Default generation function /// </remarks> private void GenerateConfiguration() { var cipher = new Threefish512(); var tweak = new UbiTweak(); // Initialize the tweak value tweak.StartNewBlockType(UbiType.Config); tweak.IsFinalBlock = true; tweak.BitsProcessed = 32; cipher.SetTweak(tweak.Tweak); cipher.Encrypt(ConfigString, ConfigValue); ConfigValue[0] ^= ConfigString[0]; ConfigValue[1] ^= ConfigString[1]; ConfigValue[2] ^= ConfigString[2]; }
/// <summary> /// Initializes the Skein hash instance /// </summary> /// /// <param name="InitializationType">Digest initialization type <see cref="SkeinInitializationType"/></param> public Skein512(SkeinInitializationType InitializationType = SkeinInitializationType.Normal) { this.InitializationType = InitializationType; _cipherStateBits = STATE_SIZE; _cipherStateBytes = STATE_SIZE / 8; _cipherStateWords = STATE_SIZE / 64; _outputBytes = (STATE_SIZE + 7) / 8; _blockCipher = new Threefish512(); // Allocate buffers _inputBuffer = new byte[_cipherStateBytes]; _cipherInput = new UInt64[_cipherStateWords]; _digestState = new UInt64[_cipherStateWords]; // Allocate tweak UbiParameters = new UbiTweak(); // initialize and enerate the configuration string SkeinConfig(); SetSchema(83, 72, 65, 51); // "SHA3" SetVersion(1); GenerateConfiguration(); Initialize(InitializationType); }