Exemple #1
0
async def test_sign_data():
    private_key = PrivateKey(SECRET)

    sign: NulsSignature = NulsSignature.sign_data(pri_key=private_key.secret,
                                                  digest_bytes=b"x" *
                                                  (256 // 8))

    assert sign
    assert type(sign.pub_key) == bytes
    assert type(sign.digest_bytes) == bytes
    assert type(sign.sig_ser) == bytes
    assert sign.ecc_type == None
async def test_compare_sign_data():
    private_key = PrivateKey(SECRET)

    sign: NulsSignature = NulsSignature.sign_data(pri_key=private_key.secret,
                                                  digest_bytes=b"x" *
                                                  (256 // 8))

    sign_deprecated: NulsSignatureSecp256k1 = (
        NulsSignatureSecp256k1.sign_data_deprecated(pri_key=private_key.secret,
                                                    digest_bytes=b"x" *
                                                    (256 // 8)))

    assert len(sign.sig_ser) == len(sign_deprecated.sig_ser)
    assert sign.sig_ser == sign_deprecated.sig_ser
    assert sign == sign_deprecated