File tree Expand file tree Collapse file tree 2 files changed +8
-352
lines changed
Expand file tree Collapse file tree 2 files changed +8
-352
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -162,7 +162,9 @@ private static final MessageDigest getDigest(String name) {
162162 */
163163 private MessageDigest cloneDigest () {
164164 try {
165- return (MessageDigest )digest .clone ();
165+ synchronized (this ) {
166+ return (MessageDigest )digest .clone ();
167+ }
166168 } catch (CloneNotSupportedException cnse ) {
167169 throw Py .RuntimeError (String .format ("_hashlib.HASH (%s) internal error" , name ));
168170 }
@@ -194,7 +196,10 @@ final void HASH_update(PyObject obj) {
194196 throw Py .TypeError ("update() argument 1 must be string or read-only buffer, not "
195197 + obj .getType ().fastGetName ());
196198 }
197- digest .update (StringUtil .toBytes (string ));
199+ byte [] input = StringUtil .toBytes (string );
200+ synchronized (this ) {
201+ digest .update (input );
202+ }
198203 }
199204
200205 public PyObject digest () {
@@ -236,7 +241,7 @@ final PyObject HASH_copy() {
236241 }
237242
238243 @ ExposedGet (name = "digestsize" )
239- public int getDigestSize () {
244+ public synchronized int getDigestSize () {
240245 return digest .getDigestLength ();
241246 }
242247
You can’t perform that action at this time.
0 commit comments