Exemple #1
0
func main() {
	flag.Parse()
	go func() {
		log.Println(http.ListenAndServe("localhost:6060", nil))
	}()
	match := *name
	if *insensitive {
		match = "(?i)" + match
	}
	target, err := regexp.Compile(match)
	checkErr(err)
	kill := make(chan os.Signal, 1)
	signal.Notify(kill, os.Interrupt, os.Kill)
	runtime.GOMAXPROCS(runtime.NumCPU())
	log.Printf("Searching for \"%s\" with %d processors", *name, runtime.NumCPU())
	c := make(chan *Trial, 1000)
	for i := 0; i < runtime.NumCPU(); i++ {
		go search(c, target)
	}
	start := time.Now()
	for {
		select {
		case <-kill:
			num := atomic.LoadUint64(&count)
			log.Printf("Tested: %d seeds at %.2f/sec", num, float64(num)/time.Since(start).Seconds())
			return
		case trial := <-c:
			s, err := crypto.NewFamilySeed(trial.Seed)
			checkErr(err)
			log.Println(s, trial.Id)
		}
	}
}
Exemple #2
0
func (s Seed) Hash() (crypto.Hash, error) {
	return crypto.NewFamilySeed(s[:])
}