I created a hex to wif format conversion util and just updated it to take input from stdin, one key per line.Now updated to be more useful - takes hex or wif private keys in and outputs related data according to a given format .
Here:
https://github.com/bkkcoins/misc/tree/master/keyfmtSo you can do this,
hexdump -v -e '/1 "%02X"' -n 32 /dev/urandom | keyfmt %w
5JZ4KXMXgewXTAjqYYaqvczXV7NuKKQibi15yGY6i6DXmNibghG
And this,
for x in {1..3}; do hexdump -v -e '/1 "%02X"' -n 32 /dev/urandom | keyfmt %w; done
5JbWBwyvNxxTiF32LfR8bA9kpvrTftpjLEXNzrNdwpGQrFDZjYg
5K2XMRW1iLddF8RX6sXRULRMaf6d6CiRoHxjkSEdTdE7ph3XKwu
5JdXrfHxp4Z3ZnsS77uvHpFUwqKm2DAJtK2X6MNP69AucYooLeP
The format argument allows you to provide a format string and it will output various related/converted data as you specify. eg.
keyfmt "Address: %a\nPrivkey: %w" - outputs format like vanitygen
keyfmt "%a:%w" - outputs format suitable for Electrum import.
Reads hex data from stdin and has currently these possible variables for output:
%h = HEX privkey
%w = WIF privkey
%p = public key
%a = address
eg.
hexdump -v -e '/1 "%02X"' -n 32 /dev/urandom | keyfmt 'Address: %a\nPrivkey: %w'
Address: 13nDMqrtEqMvDyE7MgFKYfF2i8mAAJtSZn
Privkey: 5JvJd7kdC8DeuNwKfAWWEFpLM54FXmwyPaoTDiFi4K5PB427AA9
It currently only takes HEX keys in but if people would find it useful I could have it take WIF keys as well. That would be a bit more of a swiss army bitcoin knife.Now supports either Hex or WIF input keys with autodetection.
Simple python code is a good demo of how to get public key and address from private key in Python. Requires ecdsa module (sudo pip install ecdsa).