Giter Club home page Giter Club logo

ffiasm's Introduction

ffiasm

This package is a script that generates a Finite field Library in Intel64 Assembly

Usage

install g++ nasm ang gmp library if you don't have it.

npm install -g ffiasm
mkdir myProject
cd myProject
buildzqfield -q 21888242871839275222246405745257275088548364400416034343698204186575808495617 -n Fr

You now will have two files fr.cpp, fr.hpp and fr.asm

ls

If you are in linux:

nasm -felf64 fr.asm

If you are in a mac:

nasm -fmacho64 --prefix _ fr.asm

Create a file named main.cpp to use the library

#include <stdio.h>
#include <stdlib.h>
#include "fr.hpp"

int main() {
    Fr_init();

    FrElement a;
    a.type = Fr_SHORT;
    a.shortVal = 2;

    FrElement b;
    b.type = Fr_SHORT;
    b.shortVal = 6;

    FrElement c;

    Fr_mul(&c, &a, &b);

    char *c1 = Fr_element2str(&c);
    printf("Result: %s\n", c1);
    free(c1);
}

Compile it

g++ main.cpp fr.o fr.cpp -o example -lgmp

Run it

./example

Benchmark

npm run benchmark

License

ffiasm is part of the iden3 project copyright 2020 0KIMS association and published with GPL-3 license. Please check the COPYING file for more details.

ffiasm's People

Contributors

fractasy avatar jbaylina avatar nixw4 avatar olomix avatar warforgad avatar zkronos73 avatar

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.