File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -410,7 +410,6 @@ import "C"
410410
411411import (
412412 "crypto/rand"
413- "encoding/binary"
414413 "errors"
415414 "fmt"
416415 "math/big"
@@ -545,19 +544,11 @@ func (ct *tfheCiphertext) encrypt(value big.Int, t fheUintType) {
545544
546545 switch t {
547546 case FheUint8 :
548- valBytes := [1 ]byte {}
549- value .FillBytes (valBytes [:])
550- ct .setPtr (C .client_key_encrypt_fhe_uint8 (cks , C .uchar (valBytes [len (valBytes )- 1 ])))
547+ ct .setPtr (C .client_key_encrypt_fhe_uint8 (cks , C .uchar (value .Uint64 ())))
551548 case FheUint16 :
552- valBytes := [2 ]byte {}
553- value .FillBytes (valBytes [:])
554- var valInt uint16 = binary .BigEndian .Uint16 (valBytes [:])
555- ct .setPtr (C .client_key_encrypt_fhe_uint16 (cks , C .ushort (valInt )))
549+ ct .setPtr (C .client_key_encrypt_fhe_uint16 (cks , C .ushort (value .Uint64 ())))
556550 case FheUint32 :
557- valBytes := [4 ]byte {}
558- value .FillBytes (valBytes [:])
559- var valInt uint32 = binary .BigEndian .Uint32 (valBytes [:])
560- ct .setPtr (C .client_key_encrypt_fhe_uint32 (cks , C .uint (valInt )))
551+ ct .setPtr (C .client_key_encrypt_fhe_uint32 (cks , C .uint (value .Uint64 ())))
561552 }
562553 ct .fheUintType = t
563554 ct .value = & value
You can’t perform that action at this time.
0 commit comments