Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Commit

Permalink
Make crypto implementation switchable with cmdline flags
Browse files Browse the repository at this point in the history
  • Loading branch information
tdemin committed Aug 8, 2020
1 parent 9a25e69 commit 5bd373b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 28 deletions.
10 changes: 6 additions & 4 deletions README.md
Expand Up @@ -7,10 +7,6 @@ code for generating keys and utilizing multiple CPU threads for mining.

`% go get -u -v git.tdem.in/tdemin/syg_go`

This program contains some modded code from Yggdrasil that aims to improve
performance. If you prefer to use original Yggdrasil code, set `-tags original`
flag in the command above.

### History

SimpleYggGen is originally a project by [@acetone](https://notabug.org/acetone),
Expand Down Expand Up @@ -38,13 +34,19 @@ With 8 threads on Ryzen 1700X while searching for `::` this program reaches:
* 100 000 000 iterations in 25 minutes, 58 seconds
* 500 000 000 iterations in 2 hours, 10 minutes

This program contains some modded code from Yggdrasil that aims to improve
performance. If you prefer to use original Yggdrasil code, set `-original`
flag.

### Usage

```
% syg_go -help
Usage of syg_go:
-iter uint
per how many iterations to output status (default 100000)
-original
use original Yggdrasil code
-regex string
regex to match addresses against (default "::")
-threads int
Expand Down
14 changes: 0 additions & 14 deletions crypto_original.go

This file was deleted.

10 changes: 0 additions & 10 deletions crypto_vendor.go

This file was deleted.

10 changes: 10 additions & 0 deletions main.go
Expand Up @@ -16,6 +16,7 @@ import (
"regexp"
"runtime"

"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
)

Expand All @@ -26,12 +27,21 @@ func main() {
threads := flag.Int("threads", runtime.GOMAXPROCS(0), "how many threads to use for mining")
iterationsPerOutput := flag.Uint("iter", 100000, "per how many iterations to output status")
displayVersion := flag.Bool("version", false, "display version")
origCode := flag.Bool("original", false, "use original Yggdrasil code")
flag.Parse()
if *displayVersion {
println("syg_go", version)
return
}

if *origCode {
log.Println("using unmodified Yggdrasil code")
addrForNodeID = address.AddrForNodeID
} else {
log.Println("using syg_go vendored code")
addrForNodeID = AddrForNodeID
}

regex, err := regexp.Compile(*rxflag)
if err != nil {
log.Printf("%v\n", err)
Expand Down

0 comments on commit 5bd373b

Please sign in to comment.