thank you very much. I don't know if this works. Because overnight I wrote my own version But thanks)
It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.bouncycastle.crypto.digests.RIPEMD160Digest;
import org.bouncycastle.jce.ECNamedCurveTable;
import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec;
import org.bouncycastle.math.ec.ECPoint;
public class Test
{
public static void main(String args[])
{
System.out.println(wizard("SALAMANDRA"));
}
private static String wizard(String input)
{
byte[] secret = hexStringToByteArray(getHashSHA256(input));
return createAddress(secret, true);
}
private static String createAddress(byte[] secret, boolean compressed)
{
byte[] pub = getPublicKey(secret, compressed);
byte[] h160 = getHashRIPEMD160(getHashSHA256(pub));
return getBase58Address(h160);
}
private static String getBase58Address(byte[] hash160)
{
String h160 = byteArrayToHexString(hash160);
String prefix = "00";
String addr = prefix+h160;
String hash = getHashSHA256_from_HexString(getHashSHA256_from_HexString(addr));
return hexStringToBase58(addr+hash.substring(0,8));
}
public static byte[] getPublicKey(byte[] privateKey, boolean compressed)
{
ECNamedCurveParameterSpec spec = ECNamedCurveTable.getParameterSpec("secp256k1");
ECPoint pointQ = spec.getG().multiply(new BigInteger(1, privateKey));
return pointQ.getEncoded(compressed);
}
public static String getHashSHA256_from_HexString(String str)
{
byte[] b = getHashSHA256(hexStringToByteArray(str));
return byteArrayToHexString(b);
}
private static byte[] getHashSHA256(byte[] b)
{
MessageDigest sha;
try
{
sha = MessageDigest.getInstance("SHA-256");
return sha.digest(b);
}
catch (NoSuchAlgorithmException e)
{
System.out.println("Error getHashSHA256()");
System.out.println(e.getMessage());
return null;
}
}
private static String getHashSHA256(String str)
{
try
{
byte[] b = getHashSHA256((str).getBytes("UTF-8"));
return byteArrayToHexString(b);
}
catch (UnsupportedEncodingException e) {
System.out.println("Error getHashSHA256()");
System.out.println(e.getMessage());
return "-1";
}
}
public static byte[] getHashRIPEMD160(byte[] b)
{
RIPEMD160Digest ripemd = new RIPEMD160Digest();
ripemd.update (b, 0, b.length);
byte[] hash160 = new byte[ripemd.getDigestSize()];
ripemd.doFinal (hash160, 0);
return hash160;
}
private static byte[] hexStringToByteArray(String hex)
{
if((hex.length()%2)==1) throw new IllegalArgumentException("Ungerade String-Zeichenfolge!");
int l = hex.length();
byte[] data = new byte[l/2];
for (int i = 0; i < l; i += 2)
{
data[i/2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4) + Character.digit(hex.charAt(i+1), 16));
}
return data;
}
public static String byteArrayToHexString(byte[] a)
{
StringBuilder sb = new StringBuilder(a.length * 2);
for(byte b: a)
sb.append(String.format("%02x", b));
return sb.toString();
}
public static String hexStringToBase58(String str)
{
byte[] b = hexStringToByteArray(str);
char[] c = toBase58(b);
return String.valueOf(c);
}
public static char[] toBase58(byte[] k)
{
char[] ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
BigInteger z = new BigInteger(1,k);
BigInteger z1;
BigInteger rest = new BigInteger("0");
BigInteger base = new BigInteger("58");
int laenge=0;
z1=z;
for(double i=1; i>0;)
{
z1 = z1.divide(base);
i = z1.doubleValue();
laenge++;
}
char[] Key = new char[laenge];
for(int i=laenge; i>0; i--)
{
rest = z.mod(base);
Key[i-1] = ALPHABET[rest.intValue()];
z = z.divide(base);
}
int nullLänge = 0;
for(int i=0; k[i]==0 && ichar[] EINS = {'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'};
char[] KeyOut = new char[nullLänge + Key.length];
System.arraycopy(Key, 0, KeyOut, nullLänge, Key.length);
System.arraycopy(EINS, 0, KeyOut, 0, nullLänge);
return KeyOut;
}
}