/// Format the private key to WIF format.
Format the private key to WIF format.
Format the private key to WIF format .
pub fn fmt_wif(&self, fmt: &mut fmt::Write) -> fmt::Result {
        let mut ret = [0; 34];
        ret[0] = match self.network {
            Network::Bitcoin => 128,
            Network::Testnet | Network::Regtest => 239,
        };
        ret[1..33].copy_from_slice(&self.key[..]);
        let privkey = if self.compressed {
            ret[33] = 1;
            base58::check_encode_slice(&ret[..])
        } else {
            base58::check_encode_slice(&ret[..33])
        };
        fmt.write_str(&privkey)
    }
pub fn fmt_wif ( & self , fmt : & mut fmt :: Write ) -> fmt :: Result { let mut ret = [ 0 ; 34 ] ; ret [ 0 ] = match self . network { Network :: Bitcoin => 128 , Network :: Testnet | Network :: Regtest => 239 , } ; ret [ 1 .. 33 ] . copy_from_slice ( & self . key [ .. ] ) ; let privkey = if self . compressed { ret [ 33 ] = 1 ; base58 :: check_encode_slice ( & ret [ .. ] ) } else { base58 :: check_encode_slice ( & ret [ .. 33 ] ) } ; fmt . write_str ( & privkey ) }
Format the private key to WIF format.
Format the private key to WIF format .
&self
fmt
&mut fmt::Write