Skip to content

Instantly share code, notes, and snippets.

@chappjc
Created October 28, 2021 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chappjc/8eb0423cdbb42fbadf8276b3bf756330 to your computer and use it in GitHub Desktop.
Save chappjc/8eb0423cdbb42fbadf8276b3bf756330 to your computer and use it in GitHub Desktop.
package main
import (
"encoding/hex"
"flag"
"fmt"
"os"
"decred.org/dcrdex/client/core"
)
func main() {
var appSeed string
flag.StringVar(&appSeed, "seed", "dcr", "Application Seed")
var assetID uint
flag.UintVar(&assetID, "asset", 0, "Asset ID")
flag.Parse()
appSeedB, err := hex.DecodeString(appSeed)
if err != nil {
fmt.Fprintf(os.Stderr, "bad app seed: %v\n", err)
os.Exit(1)
}
if len(appSeedB) != 64 {
fmt.Fprintf(os.Stderr, "app seed is %d bytes, expected 64\n", len(appSeedB))
os.Exit(1)
}
seed, _ := core.AssetSeedAndPass(uint32(assetID), appSeedB)
fmt.Printf("%x\n", seed)
os.Exit(0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment