mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 05:28:04 +00:00
encode_new: use tagged (sha256) hashes everywhere
This commit is contained in:
parent
62456b2a01
commit
32512b73d6
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user