Skip to content

TransformBlock\TransformFinalBlock does not work correctly or is not supported #82

@AlexanderShanin

Description

@AlexanderShanin
byte[] inputBuffer = Encoding.UTF8.GetBytes("abc");
//OK 3A985DA74FE225B2045C172D6BD390BD855F086E3E9D525B46BFE24511431532
Console.WriteLine(BitConverter.ToString(/*SHA256.Create()*/new Sha3Hash256().ComputeHash(inputBuffer)).Replace("-", ""));
using (HashAlgorithm hashAlgorithm = /*SHA256.Create()*/new Sha3Hash256()) {
    //hashAlgorithm.Initialize();
    hashAlgorithm.TransformBlock(inputBuffer, 0, inputBuffer.Length, null, 0);
    hashAlgorithm.TransformFinalBlock(new byte[0], 0, 0);
    //ERR A7FFC6F8BF1ED76651C14756A061D662F580FF4DE43B49FA82D80A4B80F8434A
    Console.WriteLine(BitConverter.ToString(hashAlgorithm.Hash).Replace("-", ""));
}

Sha3.HashCore starts with a call to Initialize. As far as I understand, HashCore should not constantly reset the state if the implementation involves multiple calls to HashAlgorithm.TransformBlock. Or is there perhaps another way to pass data in portions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions