Example #1
0
func StatusUpdate(mix *hashdb.HashMix) {
	c := time.Tick(1 * time.Minute)
	for now := range c {
		md5, sha1, err := mix.Count()
		if err != nil {
			fmt.Printf("[Status %v] Error:", now, err)
			continue
		}
		fmt.Printf("[Status %v] MD5: %d - SHA1: %d", now, md5, sha1)
	}
}
Example #2
0
func DatabaseImport(mix *hashdb.HashMix, passes chan string, result chan bool) {
	for {
		password, ok := <-passes
		if !ok {
			result <- true
			return
		}

		password_lower := strings.ToLower(password)
		password_upper := strings.ToUpper(password)
		password_capitalize := strings.Title(password_lower)

		if password_lower == password || password_lower == password_upper || password_lower == password_capitalize {
			password_lower = ""
		}

		if password_upper == password || password_upper == password_capitalize {
			password_upper = ""
		}

		if password_capitalize == password {
			password_capitalize = ""
		}

		if err := mix.Put(password); err != nil {
			println(password, "->", err.Error())
		}

		if password_lower != "" {
			if err := mix.Put(password_lower); err != nil {
				println(password_lower, "->", err.Error())
			}
		}

		if password_upper != "" {
			if err := mix.Put(password_upper); err != nil {
				println(password_upper, "->", err.Error())
			}
		}

		if password_capitalize != "" {
			if err := mix.Put(password_capitalize); err != nil {
				println(password_capitalize, "->", err.Error())
			}
		}
	}
	result <- true
}