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)
| 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 { |
no outgoing calls
no test coverage detected