Once you have the raw hex private keys, there are lots of tools available to convert those into WIF keys that can be easily imported by most wallets. For instance, you can input the hex private keys into something like the "wallet details" tab on https://www.bitaddress.org/ (download and run offline) to get both the uncompressed and compressed addresses and WIF keys... or there are multiple python scripts/tools that should be able to do the same.
Alternatively, you can probably do the reverse... and use dumpwallet in Bitcoin Core and get the "compressed" WIF keys, put those into https://www.bitaddress.org/ and you will be able to see the "uncompressed" address and WIF key (and raw hex as well).
There are certainly tools out there that will take a WIF key, decode it from Base58check into the raw bytes, then drop the trailing checksum bytes and the leading "80" byte and give you the raw HEX private key... which you can then use to go back the other way.
In fact, here is a Python3 script that I just wrote that does exactly that... it will take in a file of "compressed" WIF format keys... and outputs a file of "uncompressed" WIF format keys:
import ecdsa
import hashlib
import base58
import binascii
import argparse
def decode_WIF(comp_wif):
#WIF to bytes
decoded_bytes = base58.b58decode(comp_wif)
#bytes to string
decoded_string = binascii.hexlify(decoded_bytes)
#remove all the extra bits
raw_hex = decoded_string[2:-10] #-10 because need to drop the trailing 01 byte indicating "compressed" priv key as well as checksum
return raw_hex
def encode_WIF(hex_key):
#add '80' byte at start
extended_key = b'80' + hex_key
#calc checksum
first_sha256 = hashlib.sha256(binascii.unhexlify(extended_key)).hexdigest()
second_sha256 = hashlib.sha256(binascii.unhexlify(first_sha256)).hexdigest()
checksum = second_sha256[:8].encode('utf-8')
#append checksum
final_key = extended_key + checksum
#convert to WIF
uncompressed_WIF = base58.b58encode(binascii.unhexlify(final_key))
return uncompressed_WIF
def main():
parser = argparse.ArgumentParser(
description='Convert file of compressed WIF\'s to uncompressed WIF\'s.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('infile', default="compressed_wif_keys.txt", nargs='?', help='File to read compressed WIF keys from')
parser.add_argument('outfile', default="uncompressed_wif_keys.txt", nargs='?', help='File to write uncompressed WIF keys to')
args = parser.parse_args()
if (os.path.exists(args.infile)):
f = open(args.infile, "r")
out = open(args.outfile, "w")
for x in f:
hex_key = decode_WIF(x)
uncompressed_WIF = encode_WIF(hex_key)
out.write(uncompressed_WIF.decode('utf-8'))
out.write("\n")
f.close()
out.close()
else:
print("ERROR: File not found: " + args.infile)
print("\n")
print(parser.format_help())
if __name__ == "__main__":
main()
Then, if you create a text file called "compressed_wif_keys.txt" in the same location as the .py file, and copy paste the following compressed WIFs into it, and then run the script without any arguments:
L53ygZ65TrHFVxMATRurYb43Cgp13cvV6XbkFPegYN65GFUH1x8p
KzPTbNXTxrKYoSuJPKiRpymdDRt7HUoCcMaHAPDJhU49YmLrAZ69
L1U6eG1YM6oV8jQVm4PFhQ5cU459XHBWeS2E5Enqq6RfLDGxYnqF
KyPeSN7498myZbsXnnXpQXvxmLavRnVctewv9MoRH6Zp8GV2tqjL
L5WvodSV8qK5fXrrqhLiKXEMd1eYaaSjk5FjwxCdgm44VcGWH91L
L3pPYUHPPJ8tgjk75uUMzfstxYKvArjH8FFrkPbhuSKeyqBaNCpp
KzT21SoRLe34jM9cQizNzmbknFdBfqc3vxw9diBkMHJFF3w9i9Rr
L43FTBxA7ddVnxXnRxdi2nw3BM4PVnpCk1fP7z7aU1Zofd1XdqM7
L2tjSeHgNZvJp8nDoBnsyJ1T1tGyJmDSq2Nqryep4kLKuNNsMjDW
It should produce the following "uncompressed_wif_keys.txt" output file:
5KbCwGszeoWWZqnoYpLE3Ayso9ZrQFUyfQhVq7wkrFJ1WooMj2P
5JXv9hDnz4UK5dgVQdsAhn2xL8T5bYg1pS41VQcQwwAKhnpHFF8
5Jn7GEphdj6YkSU5FWmTtkHuScb22RWZzsXdwtA2YjvAbHujCmF
5JJpT8xJ2Pc7UKmypXhy44qUb4Xo6AQFUZcYyisPii8tTcKdVA6
5KhK5g4xmNNKGyqTFCrnABUVgsu1MkNh3WWd1fngaUerH6awWUh
5KJzDZv6yi3EyahaYvaPRr8uZ4vgEZZguPiRsACVJKRco258WUy
5JYiv7kbWpp96WwWmoDYidqf1jjdrafkiE8HTSeKtGUUF9wRZts
5KMuDH5Ljjjhxj2zREWcaV5YJkWmX5weYwyjAjr4xWaiPRjvsUE
5K6q8d691ot3gE6G8kE7Zh6zYvJfavyHj9U9offURs9TVHWiNxX
1F2f3FubHQ7v8cvcSf81xkj4rQC4URKhF - 34 digits
18w2pc9PFUfmCaR4JdKaDery3Bentp6CYy - 35 all the rest
1LJAdG24ajwgBhitKJnFfyTiSF9NaA45Jy - 35 all the rest