Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
kenta-mori3322 committed Jun 3, 2024
1 parent 234ce08 commit 7a06d44
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tee/tee_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/binary"
"encoding/json"
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
Expand Down Expand Up @@ -118,3 +119,17 @@ func Decrypt(ct *tfhe.TfheCiphertext) (TeePlaintext, error) {

return plaintext, nil
}

func DecryptToBigInt(ct *tfhe.TfheCiphertext) (*big.Int, error) {
decryptedValue, err := Decrypt(ct)
if err != nil {
return nil, err
}

plaintext := decryptedValue.Value
// Always return a 32-byte big-endian integer.
ret := make([]byte, 32)
copy(ret[32-len(plaintext):], plaintext)

return new(big.Int).SetBytes(ret), nil
}

0 comments on commit 7a06d44

Please sign in to comment.