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.

24 lines
667 B

10 years ago
package hashing
// #cgo CFLAGS: -std=c11 -D_GNU_SOURCE
// #cgo LDFLAGS: -L${SRCDIR} -lhashing -lstdc++
10 years ago
// #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
}
func FastHash(blob []byte) []byte {
return Hash(append([]byte{byte(len(blob))}, blob...), true)
}