Fernando Soder avatar

All tests successfuly completed.

fernandosoder

Published: 19 Mar 2026 › Updated: 19 Mar 2026All tests successfuly completed.

All tests successfuly completed.

Another step in the right direction.


Generated Keys

$1Keys generated using Hivetasks Key Generator


My Tests:

void TestFullCrypto::fullPipeline()
{
    QString wif =
        "5KLeD3gMsQZxgEDRp11mQzDdHvExSDgRudw1aCWt9gCwVpEhca7";

    QByteArray expectedPriv =
        QByteArray::fromHex(
            "c89f4e0d981acfdaa6c5049ffe21da2ce207fea6b2869df20abf6d780b4d866e"
            );

    QString expectedPub =
        "STM7tUu4Gy4p8UpeQUAFVCD7q8CJuEVyyEXJkCEjb4f1RL54YKt4w";

    PrivateKey priv = PrivateKey::fromWif(wif);
    QCOMPARE(priv.raw(), expectedPriv);

    PublicKey pub = priv.toPublicKey();

    QString result = pub.toString();

    QCOMPARE(result, expectedPub);
}

void TestFullCrypto::fullSecondPipeline()
{
    QString wif =
        "5KG5mB72Q7pFRPGmoy9rpfh2yXtd4cMsJeusZauqiHp2o3AV8DE";

    QString expectedPub =
        "STM6aqHre1tyTkUfBFmR5AyZfBXnUKYgR6axhME6xU6QdZpxYN2YK";

    PrivateKey priv = PrivateKey::fromWif(wif);
    PublicKey pub = priv.toPublicKey();
    QString result = pub.toString();
    QCOMPARE(result, expectedPub);
}

void TestFullCrypto::roundtrip()
{
    QString wif = "5KLeD3gMsQZxgEDRp11mQzDdHvExSDgRudw1aCWt9gCwVpEhca7";

    PrivateKey priv = PrivateKey::fromWif(wif);
    PublicKey pub = priv.toPublicKey();

    QString stm = pub.toString();

    QVERIFY(stm.startsWith("STM"));
    QCOMPARE(pub.compressed().size(), 33);
}

void TestFullCrypto::keyDerivationPipeline()
{
    QString account  = "alice";
    QString password = "supersecret";

    PrivateKey priv =
        derivePrivateKey(
            account,
            password,
            KeyRole::Active
            );

    QVERIFY(priv.raw().size() == 32);

    PublicKey pub = priv.toPublicKey();

    QByteArray compressed = pub.compressed();

    QCOMPARE(compressed.size(), 33);
    QVERIFY(
        compressed[0] == 0x02 ||
        compressed[0] == 0x03
        );

    QString stm = pub.toString();

    QVERIFY(stm.startsWith("STM"));
    QVERIFY(stm.size() > 10); // sanity
}

void TestFullCrypto::keyDerivation_knownVector()
{
    QString account  = "alice";
    QString password = "supersecret";

    PrivateKey priv =
        derivePrivateKey(
            account,
            password,
            KeyRole::Owner
            );

    QCOMPARE(
        priv.raw().toHex(),
        QByteArray("21bd739d1f6ba16b913a9bb5985741c482cea69d291844609b86566987a11059")
        );

    QString stm =
        priv.toPublicKey().toString();

    QCOMPARE(
        stm,
        QString("STM5ZkV8bAURHtU2TVVK4apWyZUkjadqRcgTV2BVny9vcP33DA7Pr")
        );
}

If you trust my capability to run a stable and updated Hive Witness...

Vote for me as your Hive Witness


If you want to support Brazilian creators...

Vote curator @perfilbrasil for Hive Witness

Delegations to perfilbrasilHive account@perfilbrasil are rewarded here.

Leave All tests successfuly completed. to:

Written by

Cientista da Computação formado pela UNISC. Gosto de feedback em minhas publicações, por isso peço que quem der "curtida" ou "thumbs-up" deixe uma mensagem, nem que seja uma única frase dizendo sua opinião. O mesmo vale para quem der flag.

Read more #hive posts


Best Posts From Fernando Soder

We have not curated any of fernandosoder's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Fernando Soder