From 86111acab0bbc4c1b2d523be1c50297f4ec8d388 Mon Sep 17 00:00:00 2001 From: joe Date: Tue, 15 Apr 2014 14:28:57 -0400 Subject: finished writeWalletKeys --- kiki.hs | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'kiki.hs') diff --git a/kiki.hs b/kiki.hs index 9c748e5..4daff67 100644 --- a/kiki.hs +++ b/kiki.hs @@ -1109,29 +1109,6 @@ secp256k1_G = ECPa secp256k1_curve -} -} -walletImportFormat idbyte k = secret_base58_foo - where - -- isSecret (SecretKeyPacket {}) = True - -- isSecret _ = False - secret_base58_foo = base58_encode seckey - Just d = lookup 'd' (key k) - (_,bigendian) = S.splitAt 2 (S.concat $ L.toChunks $ encode d) - seckey = S.cons idbyte bigendian - - -base58_encode :: S.ByteString -> String -base58_encode hash = replicate zcount '1' ++ map (base58chars !!) (reverse rdigits) - where - zcount = S.length . S.takeWhile (==0) $ hash - cksum = S.take 4 . SHA256.hash . SHA256.hash $ hash - n = foldl' (\a b->a*256+b) 0 . map asInteger $ concatMap S.unpack [hash, cksum] - asInteger x = fromIntegral x :: Integer - rdigits = unfoldr getdigit n - where - getdigit d = do - guard (d/=0) - let (q,b) = d `divMod` 58 - return (fromIntegral b,q) cannonical_eckey x y = 0x4:pad32(numToBytes x) ++ pad32(numToBytes y) :: [Word8] where -- cgit v1.2.3