static public function getHashBitLength($algorithm = null)
    {
        if (!$algorithm) {
            return self::HASH_BIT_LENGTH;
        }

        if (is_integer($algorithm)) {
            // direct hash-bit-length provided
            return (int) $algorithm;
        }
        elseif (strpos(strtolower($algorithm), "keccak-") !== false) {
            $bits = (int) substr($algorithm, -3); // keccak-256, keccak-512, etc.

            if (! in_array($bits, [256, 228, 384, 512]))
                $bits = 512;

            return $bits;
        }

        return self::HASH_BIT_LENGTH;
    }
static public function getHashBitLength($algorithm = null)
    {
        if (!$algorithm) {
            return self::HASH_BIT_LENGTH;
        }

        if (is_integer($algorithm)) {
            // direct hash-bit-length provided
            return (int) $algorithm;
        }
        elseif (strpos(strtolower($algorithm), "keccak-") !== false) {
            $bits = (int) substr($algorithm, -3); // keccak-256, keccak-512, etc.

            if (! in_array($bits, [256, 228, 384, 512]))
                $bits = 512;

            return $bits;
        }

        return self::HASH_BIT_LENGTH;
    }
static public function getHashBitLength ( $ algorithm = null ) { if ( ! $ algorithm ) { return self :: HASH_BIT_LENGTH ; } if ( is_integer ( $ algorithm ) ) { // direct hash-bit-length provided return ( int ) $ algorithm ; } elseif ( strpos ( strtolower ( $ algorithm ) , "keccak-" ) !== false ) { $ bits = ( int ) substr ( $ algorithm , - 3 ) ; // keccak-256, keccak-512, etc. if ( ! in_array ( $ bits , [ 256 , 228 , 384 , 512 ] ) ) $ bits = 512 ; return $ bits ; } return self :: HASH_BIT_LENGTH ; }
Helper function used to determine each hash's Bits length
by a given `algorithm`.

The `algorithm` parameter can be a integer directly and should
then represent a Bits Length for generated Hashes.

@param   null|string|integer     $algorithm      The hashing algorithm or Hashes' Bits Length.
@return  integer
Helper function used to determine each hash s Bits length by a given algorithm .