Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Using Bytes() to transfer an element to []byte #8

@LijinPengT

Description

@LijinPengT

Hello, Nik-U,
I utilize go pbc wrapper to achieve a proxy re-encryption algorithm.
When I using Bytes() to transfer an element to []byte, like:

e := pairing.NewGT()
temp1 := pairing.NewZr().Set1()
temp := temp1.Neg(temp1)

C0_ := C_list[1].PowZn(C_list[1], temp)
temp2 := e.Pair(skid, C0_)
plainM := C_list[0].Mul(C_list[0], temp2)

plainM_bytes := plainM.Bytes()
return plainM_bytes

I have a problem: the plainM.Bytes() return an incorrect []byte sometimes.
plainM should be [104 101 108 108 111 119 111 114 108 100], but I get [1 47 246 192 237 179 26 99 159 235 180 239 91 206 53 193 189 23 5 254 49 99 142 137 76 196 171 28 114 110 103 236 110 21 199 94 190 183 187 232 0 180 144 198 177 77 51 156 100 209 182 233 74 240 222 46 20 244 182 20 227 157 104 160 148] sometimes, which is not expected []byte.

I want to ask how can I solve this problem? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions