forked from Qortal/qortal
b90a486039
Added brokenmd160.java as command-line support for producing broken MD160 digests. Transactions, and sub-classes, now use/store public key instead of Qora address. (Qora address can be derived from public key and they take up about the same space in DB). Loads more JavaDoc for lovely mouseover help in Eclipse IDE. Crypto.verify() and Crypto.sign() moved into PublicKeyAccount and PrivateKeyAccount as appropriate. Fleshed out Block, added BlockTransactions support. Added TODO comments as Eclipse helpfully lists these for later implementation. Made loading-from-DB-constructors protected/private and also throw NoDataFoundException if unable to load from DB. Public methods can call respective constructors, catch the above exception and return null if they like. Load-from-DB-constructors are to allow sub-classes to load some data from sub-tables and super-class to load from another table. (See PaymentTransaction/Transaction for example). Using public methods allows similar argument lists but with different names, e.g. DBObject.fromSignature(Connection, byte[]) and DBObject.fromReference(Connection, byte[]) Saving into DB maybe still a bit untidy. Looking for a way to close-couple column names with place-holder bind Objects. Less of: connection.prepareStatement("INSERT INTO table (column) VALUES (?)") DB.bindInsertPlaceholders(PreparedStatement, Object...); More like: DB.insertUpdate(String tableName, SomeMagicCloseCoupledPairs...) called like: DB.insertUpdate("Cats", {"name", "Tiddles"}, {"age", 3});
22 lines
506 B
Java
22 lines
506 B
Java
import com.google.common.hash.HashCode;
|
|
|
|
import qora.crypto.BrokenMD160;
|
|
|
|
@SuppressWarnings("deprecation")
|
|
public class brokenmd160 {
|
|
|
|
public static void main(String args[]) {
|
|
if (args.length == 0) {
|
|
System.err.println("usage: broken-md160 <hex>\noutputs: hex");
|
|
System.exit(1);
|
|
}
|
|
|
|
byte[] raw = HashCode.fromString(args[0]).asBytes();
|
|
BrokenMD160 brokenMD160 = new BrokenMD160();
|
|
byte[] digest = brokenMD160.digest(raw);
|
|
|
|
System.out.println(HashCode.fromBytes(digest).toString());
|
|
}
|
|
|
|
}
|