Skip to content

Commit

Permalink
[cgo] refs fibercrypto#116 Finalized cipher.hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Jan 18, 2020
1 parent 4b89586 commit 628e3ac
Showing 1 changed file with 2 additions and 59 deletions.
61 changes: 2 additions & 59 deletions lib/cgo/cipher.hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,15 @@ import (
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include "skytypes.h"
#include "skyfee.h"
*/
import "C"

//export SKY_cipher_Ripemd160_MustSet
func SKY_cipher_Ripemd160_MustSet(_rd *C.cipher__Ripemd160, _b []byte) (____error_code uint32) {
____error_code = 0
rd := (*cipher.Ripemd160)(unsafe.Pointer(_rd))
b := *(*[]byte)(unsafe.Pointer(&_b))
rd.MustSet(b)
return
}

//export SKY_cipher_Ripemd160_Set
func SKY_cipher_Ripemd160_Set(_rd *C.cipher__Ripemd160, _b []byte) (____error_code uint32) {
____error_code = 0
rd := (*cipher.Ripemd160)(unsafe.Pointer(_rd))
b := *(*[]byte)(unsafe.Pointer(&_b))
____return_err := rd.Set(b)
Expand All @@ -39,7 +31,6 @@ func SKY_cipher_Ripemd160_Set(_rd *C.cipher__Ripemd160, _b []byte) (____error_co

//export SKY_cipher_Ripemd160FromBytes
func SKY_cipher_Ripemd160FromBytes(_b []byte, _arg1 *C.cipher__Ripemd160) (____error_code uint32) {
____error_code = 0
b := *(*[]byte)(unsafe.Pointer(&_b))
__arg1, ____return_err := cipher.Ripemd160FromBytes(b)
____error_code = libErrorCode(____return_err)
Expand All @@ -49,36 +40,16 @@ func SKY_cipher_Ripemd160FromBytes(_b []byte, _arg1 *C.cipher__Ripemd160) (____e
return
}

//export SKY_cipher_MustRipemd160FromBytes
func SKY_cipher_MustRipemd160FromBytes(_b []byte, _arg1 *C.cipher__Ripemd160) (____error_code uint32) {
____error_code = 0
b := *(*[]byte)(unsafe.Pointer(&_b))
__arg1 := cipher.MustRipemd160FromBytes(b)
copyToBuffer(reflect.ValueOf(__arg1[:]), unsafe.Pointer(_arg1), uint(SizeofRipemd160))
return
}

//export SKY_cipher_HashRipemd160
func SKY_cipher_HashRipemd160(_data []byte, _arg1 *C.cipher__Ripemd160) (____error_code uint32) {
____error_code = 0
data := *(*[]byte)(unsafe.Pointer(&_data))
__arg1 := cipher.HashRipemd160(data)
copyToBuffer(reflect.ValueOf(__arg1[:]), unsafe.Pointer(_arg1), uint(SizeofRipemd160))
return
}

//export SKY_cipher_SHA256_MustSet
func SKY_cipher_SHA256_MustSet(_g *C.cipher__SHA256, _b []byte) (____error_code uint32) {
____error_code = 0
g := (*cipher.SHA256)(unsafe.Pointer(_g))
b := *(*[]byte)(unsafe.Pointer(&_b))
g.MustSet(b)
return
}

//export SKY_cipher_SHA256_Set
func SKY_cipher_SHA256_Set(_g *C.cipher__SHA256, _b []byte) (____error_code uint32) {
____error_code = 0
g := (*cipher.SHA256)(unsafe.Pointer(_g))
b := *(*[]byte)(unsafe.Pointer(&_b))
____return_err := g.Set(b)
Expand All @@ -90,7 +61,6 @@ func SKY_cipher_SHA256_Set(_g *C.cipher__SHA256, _b []byte) (____error_code uint

//export SKY_cipher_SHA256_String
func SKY_cipher_SHA256_String(_g *C.cipher__SHA256, _arg0 *C.GoString_) (____error_code uint32) {
____error_code = 0
g := *(*cipher.SHA256)(unsafe.Pointer(_g))
__arg0 := g.String()
copyString(__arg0, _arg0)
Expand All @@ -99,7 +69,6 @@ func SKY_cipher_SHA256_String(_g *C.cipher__SHA256, _arg0 *C.GoString_) (____err

//export SKY_cipher_SHA256_Hex
func SKY_cipher_SHA256_Hex(_g *C.cipher__SHA256, _arg0 *C.GoString_) (____error_code uint32) {
____error_code = 0
g := *(*cipher.SHA256)(unsafe.Pointer(_g))
__arg0 := g.Hex()
copyString(__arg0, _arg0)
Expand All @@ -108,7 +77,6 @@ func SKY_cipher_SHA256_Hex(_g *C.cipher__SHA256, _arg0 *C.GoString_) (____error_

//export SKY_cipher_SHA256_Null
func SKY_cipher_SHA256_Null(_g *C.cipher__SHA256, _arg0 *bool) (____error_code uint32) {
____error_code = 0
g := *(*cipher.SHA256)(unsafe.Pointer(_g))
__arg0 := g.Null()
*_arg0 = __arg0
Expand All @@ -117,7 +85,6 @@ func SKY_cipher_SHA256_Null(_g *C.cipher__SHA256, _arg0 *bool) (____error_code u

//export SKY_cipher_SHA256_Xor
func SKY_cipher_SHA256_Xor(_g *C.cipher__SHA256, _b *C.cipher__SHA256, _arg1 *C.cipher__SHA256) (____error_code uint32) {
____error_code = 0
g := (*cipher.SHA256)(unsafe.Pointer(_g))
b := *(*cipher.SHA256)(unsafe.Pointer(_b))
__arg1 := g.Xor(b)
Expand All @@ -127,7 +94,6 @@ func SKY_cipher_SHA256_Xor(_g *C.cipher__SHA256, _b *C.cipher__SHA256, _arg1 *C.

//export SKY_cipher_SHA256FromHex
func SKY_cipher_SHA256FromHex(_hs string, _arg1 *C.cipher__SHA256) (____error_code uint32) {
____error_code = 0
hs := _hs
__arg1, ____return_err := cipher.SHA256FromHex(hs)
____error_code = libErrorCode(____return_err)
Expand All @@ -137,18 +103,8 @@ func SKY_cipher_SHA256FromHex(_hs string, _arg1 *C.cipher__SHA256) (____error_co
return
}

//export SKY_cipher_MustSHA256FromHex
func SKY_cipher_MustSHA256FromHex(_hs string, _arg1 *C.cipher__SHA256) (____error_code uint32) {
____error_code = 0
hs := _hs
__arg1 := cipher.MustSHA256FromHex(hs)
copyToBuffer(reflect.ValueOf(__arg1[:]), unsafe.Pointer(_arg1), uint(SizeofSHA256))
return
}

//export SKY_cipher_SHA256FromBytes
func SKY_cipher_SHA256FromBytes(_b []byte, _arg1 *C.cipher__SHA256) (____error_code uint32) {
____error_code = 0
b := *(*[]byte)(unsafe.Pointer(&_b))
__arg1, ____return_err := cipher.SHA256FromBytes(b)
____error_code = libErrorCode(____return_err)
Expand All @@ -158,18 +114,8 @@ func SKY_cipher_SHA256FromBytes(_b []byte, _arg1 *C.cipher__SHA256) (____error_c
return
}

//export SKY_cipher_MustSHA256FromBytes
func SKY_cipher_MustSHA256FromBytes(_b []byte, _arg1 *C.cipher__SHA256) (____error_code uint32) {
____error_code = 0
b := *(*[]byte)(unsafe.Pointer(&_b))
__arg1 := cipher.MustSHA256FromBytes(b)
copyToBuffer(reflect.ValueOf(__arg1[:]), unsafe.Pointer(_arg1), uint(SizeofSHA256))
return
}

//export SKY_cipher_SumSHA256
func SKY_cipher_SumSHA256(_b []byte, _arg1 *C.cipher__SHA256) (____error_code uint32) {
____error_code = 0
b := *(*[]byte)(unsafe.Pointer(&_b))
__arg1 := cipher.SumSHA256(b)
copyToBuffer(reflect.ValueOf(__arg1[:]), unsafe.Pointer(_arg1), uint(SizeofSHA256))
Expand All @@ -178,7 +124,6 @@ func SKY_cipher_SumSHA256(_b []byte, _arg1 *C.cipher__SHA256) (____error_code ui

//export SKY_cipher_DoubleSHA256
func SKY_cipher_DoubleSHA256(_b []byte, _arg1 *C.cipher__SHA256) (____error_code uint32) {
____error_code = 0
b := *(*[]byte)(unsafe.Pointer(&_b))
__arg1 := cipher.DoubleSHA256(b)
copyToBuffer(reflect.ValueOf(__arg1[:]), unsafe.Pointer(_arg1), uint(SizeofSHA256))
Expand All @@ -187,7 +132,6 @@ func SKY_cipher_DoubleSHA256(_b []byte, _arg1 *C.cipher__SHA256) (____error_code

//export SKY_cipher_AddSHA256
func SKY_cipher_AddSHA256(_a *C.cipher__SHA256, _b *C.cipher__SHA256, _arg2 *C.cipher__SHA256) (____error_code uint32) {
____error_code = 0
a := *(*cipher.SHA256)(unsafe.Pointer(_a))
b := *(*cipher.SHA256)(unsafe.Pointer(_b))
__arg2 := cipher.AddSHA256(a, b)
Expand All @@ -197,7 +141,6 @@ func SKY_cipher_AddSHA256(_a *C.cipher__SHA256, _b *C.cipher__SHA256, _arg2 *C.c

//export SKY_cipher_Merkle
func SKY_cipher_Merkle(_h0 []C.cipher__SHA256, _arg1 *C.cipher__SHA256) (____error_code uint32) {
____error_code = 0
h0 := *(*[]cipher.SHA256)(unsafe.Pointer(&_h0))
__arg1 := cipher.Merkle(h0)
copyToBuffer(reflect.ValueOf(__arg1[:]), unsafe.Pointer(_arg1), uint(SizeofSHA256))
Expand Down

0 comments on commit 628e3ac

Please sign in to comment.