LLMS_Hasher::hash( int $num )
Hash a number
Parameters Parameters
- $num
-
(int) (Required) number to hash
Return Return
(string)
Source Source
File: includes/class.llms.hasher.php
public static function hash( $num ) { $numlen = strlen( $num ); if ( $numlen <= 3 ) { $len = 3; } elseif ( 4 === $numlen || 5 === $numlen ) { $len = 4; } else { $len = 5; } $ceil = pow( 62, $len ); $primes = array_keys( self::$golden_primes ); $prime = $primes[ $len ]; $dec = self::mod( ( $num * $prime ), $ceil ); $hash = self::base62( $dec ); return str_pad( $hash, $len, '0', STR_PAD_LEFT ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.16.7 | Introduced. |