Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasMLK committed Feb 16, 2023
1 parent 1524a76 commit 23cc8fc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mvn package
<dependency>
<groupId>io.xdag</groupId>
<artifactId>xdagj-native-randomx</artifactId>
<version>0.1.4</version>
<version>0.1.5</version>
</dependency>
```

Expand All @@ -81,8 +81,8 @@ mvn package
package io.xdag.crypto.randomx;

import java.nio.charset.StandardCharsets;
import com.google.common.collect.Lists;
import com.google.common.io.BaseEncoding;
import java.util.HexFormat;
import java.util.List;

public class Example {

Expand All @@ -92,7 +92,7 @@ public class Example {

// 1. build randomx jna wrapper
RandomXWrapper randomXWrapper = RandomXWrapper.builder()
.flags(Lists.newArrayList(RandomXFlag.JIT))
.flags(List.of(RandomXFlag.JIT))
.fastInit(true)
.build();

Expand All @@ -106,11 +106,13 @@ public class Example {
byte[] hash = randomxVm.getHash(keyBytes);

// 5. print result
HexFormat hex = HexFormat.of();
System.out.println("message:" + key);
System.out.println("hash:" + BaseEncoding.base16().lowerCase().encode(hash));
System.out.println("hash:" + hex.formatHex(hash));
}
}


```

### 5. benchmark
Expand Down

0 comments on commit 23cc8fc

Please sign in to comment.