Well I don’t like the package because one must convert from and to interface but I wanted give you idea and not the full code. But of course you can join result in string like so:
package main
import (
"fmt"
"strings"
"github.com/klaidliadon/next"
)
func join(arr []interface{}) string {
buf := ""
for _, v := range arr {
buf += v.(string)
}
return buf
}
func main() {
temp := strings.Split("abcd123", "")
arr := make([]interface{}, len(temp))
for i, v := range temp {
arr[i] = v
}
for v := range next.Combination(arr, 5, true) {
fmt.Println(join(v))
}
}
func join(arr []interface{}) string {
buf := “”
for _, v := range arr {
buf += v.(string)
}
return buf
}
func main() {
temp := strings.Split(“abcd123”, “”)
arr := make([]interface{}, len(temp))
for i, v := range temp {
arr[i] = v
}
for v := range next.Combination(arr, 5, true) {
hash := sha256.Sum256([]byte(join(v)))
fmt.Println(join(v), hash)
}
}
func join(arr []interface{}) string {
buf := “”
for _, v := range arr {
buf += v.(string)
}
return buf
}
func main() {
temp := strings.Split(“abcd123”, “”)
arr := make([]interface{}, len(temp))
for i, v := range temp {
arr[i] = v
}
for v := range next.Combination(arr, 5, true) {
hash := sha256.Sum256([]byte(strconv.Itoa(join(v))))
fmt.Println("%s %X\n",join(v), hash)
}
}
its giving same error …go:26:52: cannot use join(v) (type string) as type int in argument to strconv.Itoa
Sorry to Ask Again But This code stops if i change abcd123 to abcdef0123456789 and length 5 to 64 . Don’t know whats going.
it only displayed one line and stopped? why?
From my point of view Go is really simple language (I have some experience with C++ so I can compare :D), there is excellent documentation, many articles, welcoming community here on forum.
Main thing that should learn any developer is how to formulate right question. After that you just learn specific things of one or other language. And better way to do it is working on interesting tasks. Because without wish to accomplish them learning process is really hard.
Omg. Now I reached Dead End. Looks like I have to start from beginning. one more thing should I start with c or C++ to learn. so golang will be easier? as yesterday only i got to know about some placeholders like %x %c %s %d.
thanks for your Support.