Skip to content

Commit

Permalink
Merge pull request #160 from launchdarkly/eb/sc-132580/big-seg-sha256
Browse files Browse the repository at this point in the history
fix big segments user hash algorithm to use SHA256
  • Loading branch information
eli-darkly authored Dec 9, 2021
2 parents c0481f5 + f7d58c0 commit 8f9795e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ldclient/impl/big_segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import base64
from expiringdict import ExpiringDict
from hashlib import md5
from hashlib import sha256
import time
from typing import Callable, Optional, Tuple

Expand Down Expand Up @@ -108,4 +108,4 @@ def is_stale(self, timestamp) -> bool:
return (timestamp is None) or ((int(time.time() * 1000) - timestamp) >= self.__stale_after_millis)

def _hash_for_user_key(user_key: str) -> str:
return base64.b64encode(md5(user_key.encode('utf-8')).digest()).decode('utf-8')
return base64.b64encode(sha256(user_key.encode('utf-8')).digest()).decode('utf-8')

0 comments on commit 8f9795e

Please sign in to comment.