Git Product home page Git Product logo

Comments (5)

herumi avatar herumi commented on September 28, 2024

If the value of G2 is the form (x, y), set "1 " where and are in Fp2, then they are two elements of Fp.
see https://github.com/herumi/mcl/blob/master/api.md#string-conversion
The string length you want to set is 192, so it is a concatenation of 4 elements of Fp.
So you should split the string into 4 elements x1, x2, x3 and x4, and set "1 ".
But I don't know the original string format so that it may be "1 " or so.

from mcl.

herumi avatar herumi commented on September 28, 2024

If the string format is big-endian, you must reverse each Fp element.
e.g., 0x123456 => 0x563412 .

from mcl.

herumi avatar herumi commented on September 28, 2024

If you get the string from the other library, and if the library supports ETH specification, then it is better to use Deserialize() for the other library output of serialize() after calling ETHmode() once.

from mcl.

xfaber avatar xfaber commented on September 28, 2024

The PKhexstring is a compressed PK form (bigendian)

from mcl.

herumi avatar herumi commented on September 28, 2024

Then, could you use PK.Deserialize to the data by the following FromHexStr, for example?

        public static byte[] FromHexStr(string s)
        {
            if (s.Length % 2 == 1) {
                throw new ArgumentException("s.Length is odd." + s.Length);
            }
            int n = s.Length / 2;
            var buf = new byte[n];
            for (int i = 0; i < n; i++) {
                buf[i] = Convert.ToByte(s.Substring(i * 2, 2), 16);
            }
            return buf;
        }

from mcl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.