Skip to content

Commit 76b9b5f

Browse files
author
Varun Rathore
committed
Replace farmhash to hashlib
1 parent b2d8b4f commit 76b9b5f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ unsafe-load-any-extension=no
3232
# A comma-separated list of package or module names from where C extensions may
3333
# be loaded. Extensions are loading into the active Python interpreter and may
3434
# run arbitrary code
35-
extension-pkg-whitelist= farmhash
35+
extension-pkg-whitelist=
3636

3737
# Allow optimization of some AST trees. This will activate a peephole AST
3838
# optimizer, which will apply various small optimizations. For instance, it can

firebase_admin/remote_config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from typing import Dict, Optional, Literal, Callable, Union
2222
from enum import Enum
2323
import re
24-
import farmhash
24+
import hashlib
2525
from firebase_admin import App, _http_client, _utils
2626
import firebase_admin
2727

@@ -392,7 +392,9 @@ def hash_seeded_randomization_id(self, seeded_randomization_id: str) -> int:
392392
Returns:
393393
The hashed value.
394394
"""
395-
hash64 = farmhash.fingerprint64(seeded_randomization_id)
395+
hash_object = hashlib.sha256()
396+
hash_object.update(seeded_randomization_id)
397+
hash64 = hash_object.hexdigest()
396398
return abs(hash64)
397399
def evaluate_custom_signal_condition(self, custom_signal_condition,
398400
context) -> bool:

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ google-api-core[grpc] >= 1.22.1, < 3.0.0dev; platform.python_implementation != '
1111
google-api-python-client >= 1.7.8
1212
google-cloud-firestore >= 2.9.1; platform.python_implementation != 'PyPy'
1313
google-cloud-storage >= 1.37.1
14-
pyjwt[crypto] >= 2.5.0
15-
pyfarmhash >= 0.4.0
14+
pyjwt[crypto] >= 2.5.0

0 commit comments

Comments
 (0)