考慮以下代碼: MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider(); byte[] hashedBytes; byte[] previousHashedBytes; UTF8Encoding encoder = new UTF8Encoding(); // New hashedBytes array hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(someString + theValue)); // previousHashedBytes retrieved from DB previousHashedBytes = GetPreviousValueFromDB();然后應用程序將 hashedBytes 插入到數(shù)據(jù)庫中。由于一項新政策,我需要確保無法重用 hashedBytes 值,因此我需要某種方法將現(xiàn)有 hashedBytes 值與新值進行比較。注意: 的值someString始終相同。怎樣才能比較previousHashedBytes有hashedBytes,看看他們是一樣的嗎?
比較 2 個散列字節(jié)數(shù)組
慕桂英3389331
2021-11-28 20:19:43