File tree Expand file tree Collapse file tree
hathor/nanocontracts/storage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ class AttrKey(TrieKey):
5454 key : bytes
5555
5656 def __bytes__ (self ) -> bytes :
57- return _Tag .ATTR .value + hashlib .sha1 (self .key ).digest ()
57+ return _Tag .ATTR .value + hashlib .sha256 (self .key ).digest ()
5858
5959
6060@dataclass (frozen = True , slots = True )
@@ -127,7 +127,7 @@ class MetadataKey(TrieKey):
127127 key : bytes
128128
129129 def __bytes__ (self ) -> bytes :
130- return _Tag .METADATA .value + hashlib .sha1 (self .key ).digest ()
130+ return _Tag .METADATA .value + hashlib .sha256 (self .key ).digest ()
131131
132132
133133_BLUEPRINT_ID_KEY = b'blueprint_id'
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ def calculate_id(self) -> NodeId:
6969
7070 This method assumes that all children already have their ids calculated.
7171 """
72- h = hashlib .sha1 ()
72+ h = hashlib .sha256 ()
7373 h .update (self .key )
7474 if self .content is not None :
7575 h .update (self .content )
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ def test_random_data(self) -> None:
151151 data = {}
152152 for v_int in range (20_000 ):
153153 v = str (v_int ).encode ('ascii' )
154- k = hashlib .sha1 (v ).digest ()
154+ k = hashlib .sha256 (v ).digest ()
155155 data [k ] = v
156156 trie .update (k , v )
157157
@@ -175,7 +175,7 @@ def test_commit(self) -> None:
175175 data = {}
176176 for v_int in range (20_000 ):
177177 v = str (v_int ).encode ('ascii' )
178- k = hashlib .sha1 (v ).digest ()
178+ k = hashlib .sha256 (v ).digest ()
179179 data [k ] = v
180180 trie .update (k , v )
181181 trie .commit ()
You can’t perform that action at this time.
0 commit comments