Sitemap

Installing MIRACL (for dummies)

So you don’t waste a lot of time like I did.

3 min readMay 26, 2020

--

Over the past few weeks I had to search for a crypto library so I could test my new authentication scheme I made and I ended up on the MIRACL github repository (https://github.com/miracl/MIRACL). And I was on that repo for almost 2 days breaking my head trying to figure out how to install it. I eventually figured it out after giving up on life. So I decided to make a short manual (about the installation. Not giving up on life. Don’t do that. Here’s a helpline number: 022 2754 6669).

Index

  • Requirements
  • Installation

Requirements

  1. Ubuntu 18.04
  2. x86_64 CPU architecture. You can check this on your system using the lscpu command in the terminal.

Installation

  1. DON’T clone the repo. Download the zip.
  2. Make a new folder and put the zip folder in it. Let’s assume folder’s name is MIRACL-master.zip (it will be this unless you’re getting it from somewhere else).
Press enter or click to view image in full size
Download the zip
Press enter or click to view image in full size
Make a new folder. Makes the next steps a lot easier.

3. In the folder, open the terminal and run the following command.

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

You’ll be prompted for replacing some files. Input N (as shown below).

Press enter or click to view image in full size
Input N.

You’ll now get a lot of files extracted. Don’t panic.

Press enter or click to view image in full size
Lots of files.

4. Since we’re running on a 64 bit machine, we run

bash linux64

If you’re not on a 64 bit machine run

bash linux

If you want the C++ version (which is necessary for pairing based cryptography), run

bash linux64_cpp

Press enter or click to view image in full size
Output you should get.

After this, you’ll get a folder called miracl.a . Rename it to libmiracl.a .

miracl.a

6. To compile C programs, use a variation of the following command.

gcc <fileName>.c -I <header files location> -L. -lmiracl

or

gcc <fileName>.c -I <header files location> <library name>

Conclusion

Pretty simple right? Yay! Anyway, customize the above command. Since we only have 1 library (libmiracl.a), I keep it in my root directory. I copy and paste the header files into a folder called include for my needs. (Search for header files using Ctrl+F →*.h)

Press enter or click to view image in full size
My setup

Command to compile for me

gcc 1.c -I ./include -L. -lmiracl

or

gcc 1.c -I ./include libmiracl.a

--

--

CaptainLazarus
CaptainLazarus

Written by CaptainLazarus

I do stuff. Like stuff about code. And book stuff. And gaming stuff. And stuff about life. And stuff about stuff.

Responses (4)