Code Monkey home page Code Monkey logo

mine's Introduction

banner

Mine is fast, memory-efficient, single-header minimal cryptography implementation for small-medium projects that cannot afford to link to external libraries.

Build Status Build Status Version Documentation License

Donate

Overview

It all started with ripe that depends on third-party library (initially OpenSSL then Crypto++) linked statically. However after deploying residue with ripe to older distributions of linux, we learnt that portability is an issue for ripe as minimal library (because of it's dependencies). So we started to implement standards forming Mine.

We are very careful with our implementations and have over 50 test cases in-place.

Installation (API)

Simply copy mine.h and mine.cc from package/ directory to your project or your local machine.

Alternatively, feel free to link it as shared or static library (you will need to compile yourself)

Installation (CLI Tool)

You can either download binary for your platform via releases page or using NPM

npm install -g mine-linux@latest
sudo ln -s `which mine-linux` /usr/local/bin/mine
npm install -g mine-darwin@latest
sudo ln -s `which mine-darwin` /usr/local/bin/mine

Features

Mine supports following features:

This is what we are aiming for minimal crypto library.

Notes

  • It is natively developed on macOS and Linux operating systems
  • It is extremely fast with compiler optimization level 1 (or higher)
  • RSA needs big number implementation, for unit tests we use Integer from Crypto++
  • RSA currently does not support signing & verification or reading keys from PEM files

Quick Reference

Base16

  • mine::Base16::encode(str);
  • mine::Base16::encode(str.begin(), str.end());
  • mine::Base16::decode(encoding);

Base64

  • mine::Base64::encode(str);
  • mine::Base64::encode(str.begin(), str.end());
  • mine::Base64::decode(encoding);
  • mine::Base64::decode(encoding.begin(), encoding.end());
  • mine::Base64::expectedLength(n);

AES

std::string random256BitKey = mine::AES::generateRandomKey(256);

mine::AES aesManager;
aesManager.encrypt(b16Input, hexKey, mine::MineCommon::Encoding::Base16, mine::MineCommon::Encoding::Base64); // takes base16, encrypts and returns base64

aesManager.setKey(random256BitKey); // now use this key
aesManager.encr(b16Input, mine::MineCommon::Encoding::Base16, mine::MineCommon::Encoding::Base64); // don't need key with requests
aesManager.decr(b64Input, mine::MineCommon::Encoding::Base64, mine::MineCommon::Encoding::Raw); // Returns raw string

ZLib

  • mine::ZLib::compressString(str);
  • mine::ZLib::decompressString(str);
  • mine::ZLib::decompressFile(outputFile, inputFile);

Contribution

You can contribute to the project by testing on various platforms (e.g, Windows, Android etc)

License

Copyright (c) 2017-present Amrayn Web Services
Copyright (c) 2017-present @abumusamq

https://github.com/amrayn/
https://amrayn.github.io
https://muflihun.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

mine's People

Contributors

abumq avatar

Watchers

James Cloos 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.