pub fn from_wif(wif: &str) -> Result<Privkey, encode::Error> {
        let data = base58::from_check(wif)?;

        let compressed = match data.len() {
            33 => false,
            34 => true,
            _ => { return Err(encode::Error::Base58(base58::Error::InvalidLength(data.len()))); }
        };

        let network = match data[0] {
            128 => Network::Bitcoin,
            239 => Network::Testnet,
            x   => { return Err(encode::Error::Base58(base58::Error::InvalidVersion(vec![x]))); }
        };

        let secp = Secp256k1::without_caps();
        let key = SecretKey::from_slice(&secp, &data[1..33])
            .map_err(|_| base58::Error::Other("Secret key out of range".to_owned()))?;

        Ok(Privkey {
            compressed: compressed,
            network: network,
            key: key
        })
    }
/// Parse WIF encoded private key.
Parse WIF encoded private key.
Parse WIF encoded private key .
pub fn from_wif(wif: &str) -> Result<Privkey, encode::Error> {
        let data = base58::from_check(wif)?;
        let compressed = match data.len() {
            33 => false,
            34 => true,
            _ => { return Err(encode::Error::Base58(base58::Error::InvalidLength(data.len()))); }
        };
        let network = match data[0] {
            128 => Network::Bitcoin,
            239 => Network::Testnet,
            x   => { return Err(encode::Error::Base58(base58::Error::InvalidVersion(vec![x]))); }
        };
        let secp = Secp256k1::without_caps();
        let key = SecretKey::from_slice(&secp, &data[1..33])
            .map_err(|_| base58::Error::Other("Secret key out of range".to_owned()))?;
        Ok(Privkey {
            compressed: compressed,
            network: network,
            key: key
        })
    }
pub fn from_wif ( wif : & str ) -> Result < Privkey , encode :: Error > { let data = base58 :: from_check ( wif ) ? ; let compressed = match data . len ( ) { 33 => false , 34 => true , _ => { return Err ( encode :: Error :: Base58 ( base58 :: Error :: InvalidLength ( data . len ( ) ) ) ) ; } } ; let network = match data [ 0 ] { 128 => Network :: Bitcoin , 239 => Network :: Testnet , x => { return Err ( encode :: Error :: Base58 ( base58 :: Error :: InvalidVersion ( vec ! [ x ] ) ) ) ; } } ; let secp = Secp256k1 :: without_caps ( ) ; let key = SecretKey :: from_slice ( & secp , & data [ 1 .. 33 ] ) . map_err ( | _ | base58 :: Error :: Other ( " " . to_owned ( ) ) ) ? ; Ok ( Privkey { compressed : compressed , network : network , key : key } ) }
Parse WIF encoded private key.
Parse WIF encoded private key .
wif
&str