MIRACL Cryptographic SDK: Multiprecision Integer and Rational Arithmetic Cryptographic Library is a C software library that is widely regarded by developers as the gold standard open source SDK for elliptic curve cryptography (ECC).

Related tags

Cryptography MIRACL
Overview

MIRACL

What is MIRACL? Multiprecision Integer and Rational Arithmetic Cryptographic Library – the MIRACL Crypto SDK – is a C software library that is widely regarded by developers as the gold standard open source SDK for elliptic curve cryptography (ECC).

Why is it different? While many other cryptographic SDKs are focused on PC use, MIRACL also enables developers to build security into highly constrained environments, including embedded, mobile apps and SCADA.

Full documentation can be accessed here:

MIRACL enables

  • Reduced program code
  • Greatly simplified program development
  • Developer-designed APIs
  • Rapid implementation, using inline code wrappers, example programs and other innovations

These unique qualities are the reason MIRACL, and the solutions and services built using it, are in use in hundreds of organizations across the world, including BAE Systems, Hitachi, Intel, Panasonic, Toyota and many others.

Features and Benefits: why MIRACL is the right choice

MIRACL delivers a wide and unique range of benefits, enabling developers to secure even the most constrained environments quickly, easily and effectively. It features, amongst others:
  • An inline C++ wrapper – greatly simplifying program development
  • Over 25 example programs in C and C++, covering a wide range of applications, to give development a head start
  • Optimization of both embedded processors and RAM, to help developers overcome device and memory constraints
  • Compatibility with industry security technologies including AES encryption, RSA public key cryptography, Diffie-Hellman key exchange, DSA digital signature, and others
  • A set of tools that enable any new number-theoretic technique to be implemented quickly

The MIRACL library consists of well over 100 routines that cover all aspects of multi-precision arithmetic. Two new data-types are defined - big for large integers and flash (short for floating-slash) for large rational numbers. The large integer routines are based on Knuth’s algorithms, described in Chapter 4 of his classic work ‘The Art of Computer Programming’. Floating-slash arithmetic, which works with rounded fractions, was originally proposed by D. Matula and P. Kornerup. All routines have been thoroughly optimised for speed and efficiency, while at the same time remaining standard, portable C. However optional fast assembly language alternatives for certain time-critical routines are also included, particularly for the popular Intel 80x86 range of processors. A C++ interface is also provided. Full source code is included.

Bug Tracker

MIRACL Ltd. uses JIRA for bug and feature tracking which is integrated with our development system.   If you find a bug, you should report bugs into the MIRACL bug tracker .  You can check that the bug hasn't already been reported by searching for it. If you find the bug already reported, you can add a comment of your own about it, or change its status to "Confirmed". If the bug hasn't been reported, you can file a new bug report.

Community

MIRACL Ltd. is most of all a community of like-minded information security professionals who believe that cryptography is a necessary tool to advance individual freedom and safeguard privacy. MIRACL Ltd. acts on that belief by providing tools that can be used to secure information, guard privacy and advance individual freedom.
Anyone who uses MIRACL Ltd. code or services is part of this global community, and we invite you to help shape MIRACL to better meet your needs. To make it yours!
Keep track of development and community news.

Contributing:

MIRACL Ltd. provides an Open Source suite of solutions for data security.  The MIRACL Ltd. team firmly believes that our solutions and the organizations and users who benefit by them all derive value from active contributions from the community.
You can contribute to help shape and improve our MIRACL Ltd. products.  If you have ideas and suggestions on new features and improvements that you would like to see and help bring to MIRACL Ltd., please fork the public available code on GitHub.

Authors:

MIRACL Ltd.

Copyright and License:

© 2018 MIRACL UK Ltd., All Rights Reserved.

MIRACL SDK provides developers with an extensive and efficient set of cryptographic functions. For further information about its features and functionalities please refer to https://miracl.com.

MIRACL SDK is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

MIRACL SDK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You can be released from the requirements of the license by purchasing a commercial license. Buying such a license is mandatory as soon as you develop commercial activities involving MIRACL without disclosing the source code of your own applications, or shipping MIRACL with a closed source product.

For full details regarding our MIRACL Ltd. terms of service please refer to the following links:

Issues
  • bls/BN pairing example segfaults

    bls/BN pairing example segfaults

    Hello, When I use the provided example of bls.cpp. There is a segfault that I have traced to the destructor of PFC. Am I missing something? What is being destructed that doesn't exist? Thanks, taybart

    opened by taybart 10
  • Errors in Miracl installation in MAC OS X - Updated with Steps [SOLVED]

    Errors in Miracl installation in MAC OS X - Updated with Steps [SOLVED]

    hello, I am trying to install miracl in OSX from this link https://github.com/jkhoury/MIRACL/blob/enhancement-1/README-makefile.txt

    When I try to generate KSS curve (Line number 39) in link, I am getting error of
    error: use of undeclared identifier 'to_binary' to_binary(y,bytes_per_big,&bytes[j],TRUE);

    Help please, how to solve it. Because I am trying to install java version of miracl from this link https://dsl-external.bbn.com/tracsvr/openP3S/wiki/jmiracl

    But as of now, I am not able to generate library for kss curve, I am stuck.

    Please help.

    Thanks. screen shot 2017-03-31 at 8 15 40 pm

    opened by npj008 10
  • How to serialize the cipher(G1,GT) and reload it ?

    How to serialize the cipher(G1,GT) and reload it ?

    Is there a way to do serialization in Miracl? Some Encryption Systems like ABE and broadcast encryption the cipher is the elements in G1 or GT. I want to separate the encryption process and decryption process in the example program https://github.com/miracl/MIRACL/blob/master/source/curve/pairing/cpabe.cpp to two program . So I think I should dump the Big object and G1 , GT object to a file in encryption program and reload it in Decryption program . Is there a method in Miracl can do this kind of work.

    opened by bo-hub 7
  • Point Multiplication Error

    Point Multiplication Error

    调用miracl库计算点乘时,得出的计算结果不正确,不知错误在哪里?哪位大神能帮忙指点下吗?非常感谢。实现源码如下: p1 = epoint_init(); pa = epoint_init();

    mip->IOBASE=16;
    cinstr(Para_a, "00");
    cinstr(Para_b, "05");
    cinstr(Prime_p, "B640000002A3A6F1D603AB4FF58EC74521F2934B1A7AEEDBE56F9B27E351457D");
    cinstr(Order_n, "B640000002A3A6F1D603AB4FF58EC74449F2934B18EA8BEEE56EE19CD69ECF25");
    cinstr(P1_x, "93DE051D62BF718FF5ED0704487D01D6E1E4086909DC3280E8C4E4817C66DDDD");
    cinstr(P1_y, "21FE8DDA4F21E607631065125C395BBC1C1C00CBFA6024350C464CD70A3EA616");
    cinstr(k1, "01EDEE3778F441F8DEA3D9FA0ACC4E07EE36C93F9A08618AF4AD85CEDE1C22");
    
    ecurve_init(Para_a, Para_b, Prime_p, MR_AFFINE);
    p1->marker = MR_EPOINT_NORMALIZED; 
    epoint_set(P1_x, P1_y, 0, p1);
    
    ecurve_mult(k1, p1, pa);
    cotnum(k1, stdout); 
    cotnum(p1->X, stdout);  
    cotnum(p1->Y, stdout);
    cotnum(pa->X, stdout);  
    cotnum(pa->Y, stdout);
    
    opened by newdible 7
  • Question about bilinearity of pairing

    Question about bilinearity of pairing

    Hi,

    We have completed the implementation of R-ate and now we are verifying its correctness. But we find that once we modify the parameters in the file , it can not meet the properties of bilinearity. Can you give me some advices?

    Parameters in our implementation

    Our parameters are set in advance. They just like this:

    • BN curve: y^2= x^3+b,b=5
    • Tower extension :1-2-4-12 default
    • The characteristic p of the prime field, the group order r, and the trace of Frobenius t_r of the curve are parametrized as follows: default We can easily find that our parameters are quiet similar except t and b.

    problem

    we set the point P and Q to a constant value and modify parameter t and b in in ake12bnx.cpp.Then our result are the same. But we find that it can not meet the properties of bilinearity of the R-ate Pairing. In fact ,we find default in this case.

    However, it meets the properties of bilinearity perfectly if we just use the original parameters in your file. That is to say, we will go wrong if we modify the parameters in your file.

    I wonder if there exists some combination between t and b ?Or any other reasons ?Can you give me some advices?

    Thank you!

    opened by SysFlat 7
  • Montgomery Modulus preparation breaks elliptic curve computation

    Montgomery Modulus preparation breaks elliptic curve computation

    If an elliptic curve is initialiazed and then the function prepare_monty is called then the following elliptic curve computations will be wrong. Here an example of this bug:

    int main(void) {
    
        big x,y,a,p,b, d, order, n0;
        epoint *g,*w;
    
        mip=mirsys(8/4,16);
        mip->IOBASE=10;
    
        // Dummy curve
        a = mirvar(1);
        b = mirvar(44);
        p = mirvar(229);
        x = mirvar(5);
        y = mirvar(116);
        order = mirvar(239);
        d=mirvar(4);
        n0 = mirvar(23);
    
        ecurve_init(a, b, p, MR_PROJECTIVE);  /* initialise curve */
        g = epoint_init();
        w = epoint_init();
    
        if (!epoint_set(x,y,0,g)) /* initialise point */
        {
            printf("1. Problem - point (x,y) is not on the curve\n");
            return 0;
        }
    
        // Multiplication
        ecurve_mult(d,g,w);
        epoint_get(w, x, y);
        cotnum(x, stdout);
    
        // Montgomery Modulus
        prepare_monty(n0);
    
        // Multiplication again
        ecurve_mult(d,g,w);
        epoint_get(w, x, y);
        cotnum(x, stdout);
        return 0;
    }
    

    This programm will output

    156
    12
    

    if you comment the line containing prepare_monty function it will output:

    156
    156
    
    opened by sylvainpelissier 7
  • generating primes with nxprime

    generating primes with nxprime

    I'm trying to test the compiled miracl.a with the following cpp code:

    extern "C" {
      #include "miracl.h"
      #include <stdio.h>
    }
    extern BOOL  nxprime(_MIPT_ big,big);
    extern flash mirvar(_MIPD_ int iv);
    extern miracl *mirsys(int,mr_small);
    
    #include <iostream>
    
    
    int main() {
      big a;
      miracl *mip = mirsys(5000,10);
      a = mirvar(5);
      std::cout << a->len << std::endl;
    }
    
    

    I get the following compiler output

    g++ -m64 -O2 __test__.cpp miracl.a -o test
    Undefined symbols for architecture x86_64:
      "_mirsys", referenced from:
          _main in __test__-1328d4.o
      "_mirvar", referenced from:
          _main in __test__-1328d4.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    Please help can't figure out how to use nxprime Here's the question on StackOverflow https://stackoverflow.com/questions/31218430/generating-primes-with-nxprime

    opened by sumproxy 7
  • Compile to ARM

    Compile to ARM

    I'm trying to compile this library for this architecture: uname -a: Linux localhost.localdomain 4.4.0-1030-raspi2 #37-Ubuntu SMP Thu Oct 20 15:06:25 UTC 2016 armv7l armv7l armv7l GNU/Linux

    However, I saw the arm.txt but I don't understand which modifications are necessary . In the case of different archs 64 or 32 bits , you have two libs : linux and linux64, but for ARM what is the solution?

    opened by prvsousa 6
  • OS X Compiling Issues

    OS X Compiling Issues

    Using OS X Yosemite 10.10.1 there are some problems when trying to compile.

    First using the Makefile:

    $ make
    gcc -c -O2 -I. -I/usr/lib   -c -o mrflsh4.o mrflsh4.c
    …
    gcc -c -O2 -I. -I/usr/lib   -c -o mrcore.o mrcore.c
    as   -o mrmuldv.o mrmuldv.s
    ar crv miracl.a mrflsh4.o mrflsh3.o mrflsh2.o mrpi.o mrflsh1.o mrio2.o mrio1.o mrdouble.o mrflash.o mrrand.o mrprime.o mrcrt.o mrscrt.o mrfast.o mrjack.o mrfrnd.o mrxgcd.o mrgcd.o mrstrong.o mrbrick.o mrebrick.o mrcurve.o mrshs256.o mrshs512.o mrfpe.o mrsha3.o mrshs.o mraes.o mrgcm.o mrround.o mrbuild.o mrarth3.o mrbits.o mrarth2.o mrpower.o mrsroot.o mrec2m.o mrgf2m.o mrlucas.o mrzzn2.o mrzzn2b.o mrzzn3.o mrecn2.o mrmonty.o mralloc.o mrarth1.o mrarth0.o mrsmall.o mrcore.o mrmuldv.o 
    r - mrflsh4.o
    …
    r - mrmuldv.o
    gcc -c -O2 -I. -I/usr/lib   -c -o hail.o hail.c
    make: *** No rule to make target `/usr/lib/libm.a', needed by `hail'.  Stop.
    

    It seems to want to reference libm.a which is not an OS X library to my knowledge.

    Next I tried to compile using the tips from the documentation:

    $ gcc -c -O2 -I. -I/miracl.a hail.c -o hail
    $ chmod +x hail
    $ ./hail
    -bash: ./hail: Malformed Mach-o file 
    

    Not sure why things are getting malformed.

    Lastly I tried omitting the -c -O2 flags:

    $ gcc -arch i386 -arch x86_64 -I. -I/miracl.a hail.c -o hail
    Undefined symbols for architecture i386:
      "_copy", referenced from:
          _main in hail-8a8ae1.o
      "_incr", referenced from:
          _main in hail-8a8ae1.o
      "_innum", referenced from:
          _main in hail-8a8ae1.o
      "_mirsys", referenced from:
          _main in hail-8a8ae1.o
      "_mirvar", referenced from:
          _main in hail-8a8ae1.o
      "_mr_compare", referenced from:
          _main in hail-8a8ae1.o
      "_otnum", referenced from:
          _main in hail-8a8ae1.o
      "_premult", referenced from:
          _main in hail-8a8ae1.o
      "_size", referenced from:
          _main in hail-8a8ae1.o
      "_subdiv", referenced from:
          _main in hail-8a8ae1.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    Regardless of whether it's i386 or x86_64 compiling without the flags always fails with undefined symbols.

    Are there additional libraries that are required for MIRACL on OS X that I'm not aware of? I would really like to get this running, although I've come up empty.

    opened by wankbank 6
  • Base must be binary

    Base must be binary

    After following all the instruction for installing miracl , I tried running the first sample program for testing and have gotten the following error. MIRACL error from routine mirsys called from your program Base must be binary (MR_ALWAYS_BINARY defined in mirdef.h ?)

    Any idea where I went wrong?

    The sample program I'm talking about

    #include <stdio.h>
    #include "miracl.h"
    /* include MIRACL system */
    
    void main()
    { /* calculate factorial of number */
        big nf;
        /* declare "big" variable nf */
        int n;
        miracl *mip=mirsys(5000,10);
    
        // nf=mirvar(1);
    
        printf("factorial program\n");
        printf("input number n= \n");
        scanf("%d",&n);
        getchar();
        
        while (n>1)
            premult(nf,n--,nf);
    
        printf("n!= \n");
        otnum(nf,stdout); /* output result */
    
    }
    
    opened by CaptainLazarus 5
  • raspbian install MIRACL

    raspbian install MIRACL

    I read 'first.txt' and ran the program.

    1. unzip -j -aa -L MIRACL-master.zip

    2. bash linux However, there was a problem here. gcc: error: unrecognized command line option ‘-m32’; did you mean ‘-mbe32’?

    I'd appreciate it if you could tell me how to solve it.


    raspberry pi4 Model B 8gb

    processor : 0 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 108.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3

    processor : 1 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 108.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3

    processor : 2 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 108.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3

    processor : 3 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 108.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3

    Hardware : BCM2711 Revision : d03114 Serial : 100000002327a1d1 Model : Raspberry Pi 4 Model B Rev 1.4

    opened by kimud6003 4
A small library for Asymmetric cryptography, otherwise known as public-key cryptography.

crypto-library A small library for Asymmetric cryptography, otherwise known as public-key cryptography. Self study Resources: https://en.wikipedia.org

thescientist 1 Dec 16, 2021
Small collection of tools written in C for ECC and bitcoin

ecctools Small collection of tools written in C for ECC and bitcoin Why this programs are written in C language? Well i like C language because compil

Luis Alberto 18 Jun 15, 2022
Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

Tink A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse. Ubuntu

Google 12.4k Jun 23, 2022
Intel:registered: Homomorphic Encryption Acceleration Library accelerates modular arithmetic operations used in homomorphic encryption

Intel Homomorphic Encryption Acceleration Library (HEXL) Intel ®️ HEXL is an open-source library which provides efficient implementations of integer a

Intel Corporation 143 Jun 27, 2022
Mbedcrypto - a portable, small, easy to use and fast c++14 library for cryptography.

mbedcrypto mbedcrypto is a portable, small, easy to use, feature rich and fast c++14 library for cryptography based on fantastic and clean mbedtlsnote

amir zamani 37 Jun 16, 2022
Retter - A collection of hash functions, ciphers, tools, libraries, and materials related to cryptography & security

Retter - A collection of hash functions, ciphers, tools, libraries, and materials related to cryptography & security.

Maciej A. Czyzewski 72 Jun 23, 2022
Finalists to the NIST lightweight cryptography competition

LWC Finalists This repository contains implementations of the 10 finalists in the NIST lightweight cryptography competition: ASCON, Elephant, GIFT-COF

null 30 Jun 3, 2022
In cryptography, a cipher is an algorithm for performing encryption or decryption.

Cipher 1.0 In cryptography, a cipher is an algorithm for performing encryption or decryption. What can be done using this program? This program can us

null 1 Apr 21, 2022
Cryptography Toolkit

Botan: Crypto and TLS for Modern C++ Botan (Japanese for peony flower) is a C++ cryptography library released under the permissive Simplified BSD lice

Jack Lloyd 1.9k Jun 20, 2022
A collection of public domain/unlicense single-file cryptography

simple-crypto A collection of single-file public domain/unlicense cryptographic functions in different programming languages. Feel free to copy-paste

null 5 May 16, 2022
The UAPKI is crypto library for using in PKI with support of Ukrainian and internationlal cryptographic standards.

UAPKI The UAPKI is crypto library for using in PKI with support of Ukrainian and internationlal cryptographic standards. Fork from Cryptonite. Expert

null 23 May 27, 2022
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.5k Jun 25, 2022
free C++ class library of cryptographic schemes

Crypto++: free C++ Class Library of Cryptographic Schemes Version 8.4 - TBD Crypto++ Library is a free C++ class library of cryptographic schemes. Cu

null 3.5k Jun 24, 2022
Reference implementations of post-quantum cryptographic primitives

PQ Crypto Catalog Implementation of quantum-safe signature and KEM schemes submitted to NIST PQC Standardization Process. The goal is to provide an ea

Kris Kwiatkowski 18 Mar 30, 2022
OSS-Sydr-Fuzz - OSS-Fuzz fork for hybrid fuzzing (fuzzer+DSE) open source software.

OSS-Sydr-Fuzz: Hybrid Fuzzing for Open Source Software This repository is a fork of OSS-Fuzz project. OSS-Sydr-Fuzz contains open source software targ

Ivannikov Institute for System Programming of the Russian Academy of Sciences 20 Jun 23, 2022
An implementation of Advanced Encryption Standard with calculative optimization

An implementation of Advanced Encryption Standard with calculative optimization. Complete round operations in a single function.

Echo Heath 1 Jan 24, 2022
This repository aims to provide an easy-to-use implementation of the Secure Hash Standard as specified in FIPS 180-4

HashLibCpp This repository aims to provide an easy-to-use implementation of the Secure Hash Standard. (currently implemented are SHA224, SHA256 and SH

ADD1609 1 Feb 2, 2022
An open source, portable, easy to use, readable and flexible SSL library

README for Mbed TLS Mbed TLS is a C library that implements cryptographic primitives, X.509 certificate manipulation and the SSL/TLS and DTLS protocol

Arm Mbed 3.6k Jun 30, 2022