Skip to content
/ ffiasm Public
forked from 0xPolygonID/ffiasm

Intel assembly finite field library generator

License

Notifications You must be signed in to change notification settings

okx/ffiasm

This branch is 12 commits ahead of 0xPolygonID/ffiasm:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

585900a · Nov 25, 2024

History

89 Commits
Dec 31, 2023
Nov 25, 2024
Dec 31, 2023
Nov 22, 2024
Jun 5, 2023
Dec 31, 2023
Mar 26, 2020
Dec 31, 2023
Nov 22, 2024
Dec 31, 2023
Mar 26, 2020
Nov 29, 2023
Dec 31, 2023
Mar 26, 2020
May 18, 2023
May 18, 2023
Dec 31, 2023

Repository files navigation

⚠️ This repository was moved to https://github.com/iden3/ffiasm.

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.

About

Intel assembly finite field library generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Assembly 53.7%
  • EJS 18.1%
  • C++ 16.9%
  • JavaScript 9.5%
  • Shell 1.2%
  • CMake 0.5%
  • C 0.1%