File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
lib/sdk/server/src/main/java/com/launchdarkly/sdk/server Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
import org .apache .commons .codec .digest .DigestUtils ;
9
9
10
+ import java .nio .charset .StandardCharsets ;
11
+ import java .nio .CharBuffer ;
12
+ import java .security .MessageDigest ;
13
+
10
14
/**
11
15
* Encapsulates the logic for percentage rollouts.
12
16
*/
@@ -59,7 +63,9 @@ static float computeBucketValue(
59
63
}
60
64
61
65
// turn the first 15 hex digits of this into a long
62
- byte [] hash = DigestUtils .sha1 (keyBuilder .toString ());
66
+ MessageDigest digest = DigestUtils .getSha1Digest ();
67
+ digest .update (StandardCharsets .UTF_8 .encode (CharBuffer .wrap (keyBuilder )));
68
+ byte [] hash = digest .digest ();
63
69
long longVal = 0 ;
64
70
for (int i = 0 ; i < 7 ; i ++) {
65
71
longVal <<= 8 ;
You can’t perform that action at this time.
0 commit comments