コード例 #1
0
ファイル: hashstring.go プロジェクト: kaustavha/kirisurf
func hash_base32(data []byte) string {
	return strings.ToLower(base32.StdEncoding.EncodeToString(
		kicrypt.InvariantHash(data)[:20]))
}
コード例 #2
0
ファイル: main.go プロジェクト: kaustavha/kirisurf
package main

import (
	"encoding/base32"
	"kirisurf/ll/dirclient"
	"kirisurf/ll/kicrypt"
	"kirisurf/ll/kiss"
	"runtime"
	"strconv"
	"strings"
	"time"
)

var MasterKey = kicrypt.SecureDH_genpair()
var MasterKeyHash = strings.ToLower(base32.StdEncoding.EncodeToString(
	kicrypt.InvariantHash(MasterKey.Public.Bytes())[:20]))

func main() {
	kiss.SetCipher(kicrypt.AS_aes256_ofb)
	INFO("Kirisurf started! CPU count: %d", runtime.NumCPU())
	runtime.GOMAXPROCS(runtime.NumCPU())
	go run_monitor_loop()
	go run_diagnostic_loop()
	dirclient.DIRADDR = MasterConfig.General.DirectoryURL
	dirclient.RefreshDirectory()
	if MasterConfig.General.Role == "server" {
		NewSCServer(MasterConfig.General.ORAddr)
		prt, _ := strconv.Atoi(
			strings.Split(MasterConfig.General.ORAddr, ":")[1])
		dirclient.RunRelay(prt, MasterKeyHash,
			MasterConfig.General.IsExit)