私は、あなたのサンプルコードがこれとほぼ同じであることは確かではありませんが、テストされていません。
byte[] hashA, hashB, hashC;
using (var sha = new SHA256Managed())
{
hashA = sha.ComputeHash(Encoding.UTF8.GetBytes(yy + xx));
hashB = sha.ComputeHash(Encoding.UTF8.GetBytes(yy + xx + yy));
hashC = sha.ComputeHash(Encoding.UTF8.GetBytes(yy + xx + yy + xx));
}
さまざまなPythonメソッドについては、 hashlib
のドキュメントで説明しています。
copy
makes a clone of the hash object's current state; update
appends a new string onto the hash object's existing input string; digest
generates the hash (aka, message digest) from the hash object's existing input string and returns it as a sequence of bytes.
.NETやC#で私が認識している同等のものはありません。正に言えば、 hashlib
の移植ではあまり価値はないようです。私の意見では、組み込みの.NETハッシュライブラリを使用すると、より短く理解しやすいコードが得られます。