MCPcopy Index your code
hub / github.com/CDSecLab/MJXT / reduce

Method reduce

src/main/java/utils/Hash.java:35–38  ·  view source on GitHub ↗

Shrink the hash to a value 0..n. Kind of like modulo, but using multiplication and shift, which are faster to compute. @param hash the hash @param n the maximum of the result @return the reduced value

(int hash, int n)

Source from the content-addressed store, hash-verified

33 * @return the reduced value
34 */
35 public static int reduce(int hash, int n) {
36 // http://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/
37 return (int) (((hash & 0xffffffffL) * n) >>> 32);
38 }
39
40 public static byte[] Get_SHA_256(byte[] passwordToHash) {
41 try {

Callers 4

searchMethod · 0.95
getHashMethod · 0.95
addMethod · 0.95
mayContainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected