Answer the question
In order to leave comments, you need to log in
How to get a hash from a string using Java?
I'm trying to implement a string
in Java . for example "Vasya!".
at the output I want to get a string like
K21ZG4GJpDjS26p1Ksn3U9JTJJr1Dt3ffwdEZLzjonMoN3AUHtxh
(private key bitcoin)
as far as I figured out this is Hash256.
But when I try to
String sha256hex = org.apache.commons.codec.digest.DigestUtils.sha256Hex("Vasya!");
Answer the question
In order to leave comments, you need to log in
K21ZG4GJpDjS26p1Ksn3U9JTJJr1Dt3ffwdEZLzjonMoN3AUHtxhis a hash in base 62 (AZ, az, 0-9). How it was obtained, I have no idea. Whether the private key bitcoin was obtained by simply calculating the hash from the string - I don’t know.
https://bitcoinj.org/
a bunch of methods for working with bitcoin, incl. with private keys, generation validation, signing lines of text based on the private key of your address, etc.
for example, to sign or verify the signature of a message, you need to use the org.bitcoinj.core.ECKey.signMessage(String message) method after creating the ECKey key
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question