I wrote this to create a deterministic wallet based on any string:
#!/usr/bin/perl
use strict;
use Digest::SHA qw( sha256 );
my $phrase = $ARGV[0];
my $iter = $ARGV[1] || 10;
my $hash = '';
foreach ( 1 .. $iter ) {
$hash = sha256( $hash.$phrase );
my( $key, $address ) = string2keypair( $hash );
print "$key\t$address\n";
}
sub string2keypair {
my $key = chr(0x80).shift;
my $hash = substr( sha256( sha256( $key ) ), 0, 4 );
$key = unpack( 'H*', $key.$hash );
$key = `./base58encode.sh $key`;
`./keyconv $key` =~ m|Address: (1.*)|;
my $address = $1;
return ( $key, $address );
}
__END__
./base58encode.sh:
#!/bin/bash
base58=({1..9} {A..H} {J..N} {P..Z} {a..k} {m..z})
bc <<<"ibase=16; n=${1^^}; while(n>0) { n%3A ; n/=3A }" |
tac |
while read n
do echo -n ${base58[n]}
done
It uses "keyconv" from vanitygen.