-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathrxVM.go
More file actions
39 lines (33 loc) · 829 Bytes
/
rxVM.go
File metadata and controls
39 lines (33 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package randomx
func NewRxVM(rxDataset *RxDataset, flags ...Flag) (*RxVM, error) {
if rxDataset.rxCache == nil {
vm, err := CreateVM(nil, rxDataset.dataset, flags...)
return &RxVM{
vm: vm,
rxDataset: nil,
}, err
}
vm, err := CreateVM(rxDataset.rxCache.cache, rxDataset.dataset, flags...)
return &RxVM{
vm: vm,
rxDataset: nil,
}, err
}
func (vm *RxVM) Close() {
if vm.vm != nil {
DestroyVM(vm.vm)
}
}
func (vm *RxVM) CalcHash(in []byte) []byte {
return CalculateHash(vm.vm, in)
}
func (vm *RxVM) CalcHashFirst(in []byte) {
CalculateHashFirst(vm.vm, in)
}
func (vm *RxVM) CalcHashNext(in []byte) []byte {
return CalculateHashNext(vm.vm, in)
}
func (vm *RxVM) UpdateDataset(rxDataset *RxDataset) {
SetVMCache(vm.vm, rxDataset.rxCache.cache)
SetVMDataset(vm.vm, rxDataset.dataset)
}