Kevacoin stratum server for solo-mining
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package hashing
|
|
|
|
|
|
|
|
// #cgo CFLAGS: -std=c11 -D_GNU_SOURCE
|
|
|
|
// #cgo LDFLAGS: -L${SRCDIR} -lhashing -Wl,-rpath ${SRCDIR} -lstdc++
|
|
|
|
// #include <stdlib.h>
|
|
|
|
// #include <stdint.h>
|
|
|
|
// #include "src/hashing.h"
|
|
|
|
import "C"
|
|
|
|
import "unsafe"
|
|
|
|
|
|
|
|
func Hash(blob []byte, fast bool) []byte {
|
|
|
|
output := make([]byte, 32)
|
|
|
|
if fast {
|
|
|
|
C.cryptonight_fast_hash((*C.char)(unsafe.Pointer(&blob[0])), (*C.char)(unsafe.Pointer(&output[0])), (C.uint32_t)(len(blob)))
|
|
|
|
} else {
|
|
|
|
C.cryptonight_hash((*C.char)(unsafe.Pointer(&blob[0])), (*C.char)(unsafe.Pointer(&output[0])), (C.uint32_t)(len(blob)))
|
|
|
|
}
|
|
|
|
return output
|
|
|
|
}
|