public static function getEntropyChecksumHex($entropyBytes)
    {
        $checksumLengthBits = (strlen($entropyBytes)*8) / 32;
        $hashBytes = hash('sha256', $entropyBytes, true);

        // base_convert can only handle up to 64 bits, so we have to reduce the
        // length of data that gets sent to it
        $checksumLengthBytes = ceil($checksumLengthBits / 8);
        $reducedBytesToChecksum = substr($hashBytes, 0, $checksumLengthBytes);

        $reducedChecksumHex = bin2hex($reducedBytesToChecksum);
        $reducedChecksumBits = str_pad(base_convert($reducedChecksumHex, 16, 2), $checksumLengthBytes * 8, '0', STR_PAD_LEFT);

        $checksumBitstring = substr($reducedChecksumBits, 0, $checksumLengthBits);
        $checksumHex = static::bitstringToHex($checksumBitstring);

        return $checksumHex;
    }
public static function getEntropyChecksumHex($entropyBytes)
    {
        $checksumLengthBits = (strlen($entropyBytes)*8) / 32;
        $hashBytes = hash('sha256', $entropyBytes, true);

        // base_convert can only handle up to 64 bits, so we have to reduce the
        // length of data that gets sent to it
        $checksumLengthBytes = ceil($checksumLengthBits / 8);
        $reducedBytesToChecksum = substr($hashBytes, 0, $checksumLengthBytes);

        $reducedChecksumHex = bin2hex($reducedBytesToChecksum);
        $reducedChecksumBits = str_pad(base_convert($reducedChecksumHex, 16, 2), $checksumLengthBytes * 8, '0', STR_PAD_LEFT);

        $checksumBitstring = substr($reducedChecksumBits, 0, $checksumLengthBits);
        $checksumHex = static::bitstringToHex($checksumBitstring);

        return $checksumHex;
    }
public static function getEntropyChecksumHex ( $ entropyBytes ) { $ checksumLengthBits = ( strlen ( $ entropyBytes ) * 8 ) / 32 ; $ hashBytes = hash ( 'sha256' , $ entropyBytes , true ) ; // base_convert can only handle up to 64 bits, so we have to reduce the // length of data that gets sent to it $ checksumLengthBytes = ceil ( $ checksumLengthBits / 8 ) ; $ reducedBytesToChecksum = substr ( $ hashBytes , 0 , $ checksumLengthBytes ) ; $ reducedChecksumHex = bin2hex ( $ reducedBytesToChecksum ) ; $ reducedChecksumBits = str_pad ( base_convert ( $ reducedChecksumHex , 16 , 2 ) , $ checksumLengthBytes * 8 , '0' , STR_PAD_LEFT ) ; $ checksumBitstring = substr ( $ reducedChecksumBits , 0 , $ checksumLengthBits ) ; $ checksumHex = static :: bitstringToHex ( $ checksumBitstring ) ; return $ checksumHex ; }
Returns the hex-encoded checksum for the raw bytes in the entropy

@param $entropyBytes
@return string
Returns the hex - encoded checksum for the raw bytes in the entropy