Files
ALPHA-TRAIN2/services/services 4/tiktak/keygen/keygen.go
T
h1z3 5d765a09db
build-and-push / detect (push) Successful in 10s
build-and-push / build (${{ fromJSON(needs.detect.outputs.services) }}) (push) Successful in 51s
sploit for arena-battle
2026-08-26 11:29:05 +03:00

28 lines
491 B
Go

package keygen
/*
#cgo LDFLAGS: ${SRCDIR}/legacy/keygen.a -lm
#include <keygen.h>
*/
import "C"
import (
"strings"
"unsafe"
)
func GenerateKey(vid int) string {
var key [C.TOK_SIZE]byte
keyPtr := (*C.char)(unsafe.Pointer(&key[0]))
C.GenerateToken(C.int(vid), keyPtr)
res := strings.Builder{}
for _, v := range key {
res.WriteByte(v)
}
return res.String()
}
func ValidateKey(token string, vid int) bool {
res := C.ValidateToken(C.int(vid), C.CString(token))
return res == 1
}