From 32512b73d6fe61ca82a61b790077ed21bd3b9598 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Fri, 30 Mar 2007 11:32:13 -0700
Subject: [PATCH] encode_new: use tagged (sha256) hashes everywhere

---
 src/allmydata/encode_new.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/allmydata/encode_new.py b/src/allmydata/encode_new.py
index 13c25814..6500a3bf 100644
--- a/src/allmydata/encode_new.py
+++ b/src/allmydata/encode_new.py
@@ -4,14 +4,10 @@ from zope.interface import implements
 from twisted.internet import defer
 from allmydata.chunk import HashTree, roundup_pow2
 from allmydata.Crypto.Cipher import AES
-import sha
-from allmydata.util import mathutil
+from allmydata.util import mathutil, hashutil
 from allmydata.codec import CRSEncoder
 from allmydata.interfaces import IEncoder
 
-def hash(data):
-    return sha.new(data).digest()
-
 """
 
 The goal of the encoder is to turn the original file into a series of
@@ -165,7 +161,8 @@ class Encoder(object):
             shareid = shareids[i]
             d = self.send_subshare(shareid, self.segment_num, subshare)
             dl.append(d)
-            self.subshare_hashes[shareid].append(hash(subshare))
+            subshare_hash = hashutil.tagged_hash("encoded subshare", subshare)
+            self.subshare_hashes[shareid].append(subshare_hash)
         self.segment_num += 1
         return defer.DeferredList(dl)
 
-- 
2.45.2