public function mnemonicToEntropy($mnenomic)
    {
        $bitstring = $this->parseMnemonic($mnenomic);

        // Calculate expected lengths
        $numChecksumBits = strlen($bitstring) / 33;
        $numEntropyBits = strlen($bitstring) - $numChecksumBits;

        // Get checksum bits from the end of the string
        $checksumBits = substr($bitstring, -1 * $numChecksumBits);
        $checksumHex = static::bitstringToHex($checksumBits);

        // Remaining bits are the entropy
        $entropyBits = substr($bitstring, 0, $numEntropyBits);
        $entropyHex = static::bitstringToHex($entropyBits);

        $entropyBytes = hex2bin($entropyHex);

        if ($checksumHex !== static::getEntropyChecksumHex($entropyBytes)) {
            throw new \InvalidArgumentException('Invalid checksum');
        }

        return $entropyBytes;
    }
public function mnemonicToEntropy($mnenomic)
    {
        $bitstring = $this->parseMnemonic($mnenomic);

        // Calculate expected lengths
        $numChecksumBits = strlen($bitstring) / 33;
        $numEntropyBits = strlen($bitstring) - $numChecksumBits;

        // Get checksum bits from the end of the string
        $checksumBits = substr($bitstring, -1 * $numChecksumBits);
        $checksumHex = static::bitstringToHex($checksumBits);

        // Remaining bits are the entropy
        $entropyBits = substr($bitstring, 0, $numEntropyBits);
        $entropyHex = static::bitstringToHex($entropyBits);

        $entropyBytes = hex2bin($entropyHex);

        if ($checksumHex !== static::getEntropyChecksumHex($entropyBytes)) {
            throw new \InvalidArgumentException('Invalid checksum');
        }

        return $entropyBytes;
    }
public function mnemonicToEntropy ( $ mnenomic ) { $ bitstring = $ this -> parseMnemonic ( $ mnenomic ) ; // Calculate expected lengths $ numChecksumBits = strlen ( $ bitstring ) / 33 ; $ numEntropyBits = strlen ( $ bitstring ) - $ numChecksumBits ; // Get checksum bits from the end of the string $ checksumBits = substr ( $ bitstring , - 1 * $ numChecksumBits ) ; $ checksumHex = static :: bitstringToHex ( $ checksumBits ) ; // Remaining bits are the entropy $ entropyBits = substr ( $ bitstring , 0 , $ numEntropyBits ) ; $ entropyHex = static :: bitstringToHex ( $ entropyBits ) ; $ entropyBytes = hex2bin ( $ entropyHex ) ; if ( $ checksumHex !== static :: getEntropyChecksumHex ( $ entropyBytes ) ) { throw new \ InvalidArgumentException ( 'Invalid checksum' ) ; } return $ entropyBytes ; }
Converts a mnemonic to raw bytes

NOTE: this is NOT the raw bytes used for a Stellar key! See mnemonicToSeedBytes

@param $mnenomic
@return bool|string
Converts a mnemonic to raw bytes