Skip to content

Commit 13deec5

Browse files
author
Wenhua Zhang
committed
typo
1 parent 0ce741c commit 13deec5

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎src/main/java/org/tron/common/zksnark/LibrustzcashParam.java‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,26 @@ public void valid() throws ZksnarkException {
613613
validParamLength(spendAuthSig, 64);
614614
valid32Params(sighashValue);
615615
}
616+
617+
public static SaplingCheckSpendParams decode(Pointer ctx, byte[] data, byte[] sigHashValue)
618+
throws ZksnarkException {
619+
byte[] cv = new byte[32];
620+
byte[] anchor = new byte[32];
621+
byte[] nullifier = new byte[32];
622+
byte[] rk = new byte[32];
623+
byte[] zkproof = new byte[192];
624+
byte[] spendAuthSig = new byte[64];
625+
626+
System.arraycopy(data, 0, cv, 0, 32);
627+
System.arraycopy(data, 32, anchor, 0, 32);
628+
System.arraycopy(data, 64, nullifier, 0, 32);
629+
System.arraycopy(data, 96, rk, 0, 32);
630+
System.arraycopy(data, 128, zkproof, 0, 192);
631+
System.arraycopy(data, 320, spendAuthSig, 0, 64);
632+
633+
return new SaplingCheckSpendParams(ctx, cv, anchor, nullifier, rk, zkproof, spendAuthSig,
634+
sigHashValue);
635+
}
616636
}
617637

618638
/**

0 commit comments

Comments
 (0)