package main
import(
//"unicode/utf8"
"math/rand"
"strconv"
"strings"
"fmt"
"time"
"os"
)
var alphanumerics = [62] string {
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
"0","1","2","3","4","5","6","7","8","9",
"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
}
func main(){
var (
txtflpth string = "C:\\Workspace\\Transaction Hash.txt"
flNm string = "Transaction Hash.txt"
CRLF string = "\n"
cntstrt string
AuthKey string
NwStr string
cstart int
cntr int
flEx *os.FileInfo
flEx2 *os.File
trfl *os.File
err error
)
fmt.Print("State where the hash counter should begin:>> ")
fmt.Scanln(&cntstrt)
if cntstrt == "" || cntstrt == " " {
trfl, err = os.Create(flNm)
if err != nil { panic(err); os.Exit(-1) }
defer trfl.Close()
} else {
var flEx, err = os.Stat(txtflpth)
fmt.Println(flEx.Mode().String)
//fmt.Println(flEx.IsRegular())
fmt.Println(flEx.IsDir())
fmt.Println(flEx.Name())
fmt.Println(flEx.Size())
fmt.Println(flEx.Sys())
if err != nil { if os.IsNotExist(err) { panic(err) } }
cstart, err = strconv.Atoi(cntstrt)
flEx2, err := os.Open(txtflpth)
defer flEx2.Close()
}
/*defer func(
if err == trfl.Close() || err == os.IsNotExist(err)!= err { panic(err) }
if err == flEx.Close() || err == os.IsNotExist(err)!= err { panic(err) }
)*/
if cntstrt != "" && cntstrt != " " { cntr = cstart }
for cntr = cstart; cntr < cstart + 1000; cntr++ {
NwStr = ""
AuthKey = NwStr
for i := 0; i <= 65; i++ {
time.Sleep(10 * time.Nanosecond)
rand.Seed(time.Now().UnixNano())
AuthKey = AuthKey + alphanumerics[rand.Intn(62)] //, [A - Z], [0-9])
}
var hashRemap = [...] string {"A","U","G","D","E","X"}
AuthKey = "0x" + AuthKey
fmt.Println("Transaction Hash: " + strconv.Itoa(cntr) + ") " + AuthKey)
//AuthKey2 := []rune(AuthKey)
StrPos := strings.Index(AuthKey, AuthKey[9:10])
fmt.Printf("The old character %s is at string position: (%d) " + CRLF,AuthKey[9:10], StrPos)
//os.Exit(1)
for i := 0; i < 6; i++ {
switch i {
case 0: AuthKey = strings.Replace(AuthKey,AuthKey[9:10], hashRemap[0], 1); fmt.Println("Replaced! The New Transaction Hash: " + "(" + strconv.Itoa(i) + ") " + AuthKey); os.Exit(1);
case 1: AuthKey = strings.Replace(AuthKey,"", hashRemap[1], 1)
case 2: AuthKey = strings.Replace(AuthKey,"", hashRemap[3], 1)
case 3: AuthKey = strings.Replace(AuthKey,"", hashRemap[4], 1)
case 4: AuthKey = strings.Replace(AuthKey,"", hashRemap[5], 1)
case 5: AuthKey = strings.Replace(AuthKey,"", hashRemap[5], 1)
}
}
fmt.Println("Transaction Hash: " + strconv.Itoa(cntr) + ") " + AuthKey)
if trfl != nil { trfl.WriteString("Transaction Hash: " + strconv.Itoa(cntr) + ") " + AuthKey + CRLF) }
if flEx != nil { flEx2.WriteString("Transaction Hash: " + strconv.Itoa(cntr) + ") " + AuthKey + CRLF) }