use of com.github.zhenwei.sdk.builder.params.DigestParams in project LinLong-Java by zhenwei1108.
the class RealHashTest method sm3Digest.
@Test
public void sm3Digest() throws BaseWeGooException {
WeGooProvider provider = new WeGooProvider();
HashBuilder builder = new HashBuilder(provider);
byte[] source = "asdf".getBytes(StandardCharsets.UTF_8);
byte[] digest = builder.digest(DigestAlgEnum.SM3, source);
System.out.println(Hex.toHexString(digest));
// 公钥参与运算
KeyBuilder keyBuilder = new KeyBuilder(provider);
KeyPair keyPair = keyBuilder.buildKeyPair(KeyPairAlgEnum.SM2_256);
DigestParams digestParams = new DigestParams(keyPair.getPublic());
digest = builder.digest(DigestAlgEnum.SM3, source, digestParams);
System.out.println(Hex.toHexString(digest));
}
Aggregations