Hello dsiders, thanks for the answer.
You did not reset the position for the Encripted stream after it was written by Cipher and before it was read by Decipher.
I changed the code, but the error persists.
See:
try
cipher:= TDCP_rijndael.Create(nil);
cipher.BlockSize:= 256;
cipher.InitStr('test', TDCP_sha256);
cipher.EncryptStream(raw, encripted, raw.Size);
cipher.Burn;
cipher.Free;
//The change
encripted.Position:= 0;
decipher:= TDCP_rijndael.Create(nil);
decipher.BlockSize:= 256;
decipher.InitStr('test', TDCP_sha256);
decipher.DecryptStream(encripted, decripted, encripted.Size);
decipher.Burn;
decipher.Free;
decripted.Position:= 0;
decripted.ReadBuffer(outputData, SizeOf(outputData));
result:= true;
except
ShowMessage('Fatal error.');
end;
Note: when debugging, I saw from watches and noted the "encripted" shows "MEMORY: nil" on properties (attached images).