Git Product home page Git Product logo

nimcrypto's Introduction

nimcrypto Build Status Build Status

Nim cryptographic library

Introduction

Nimcrypto is Nim's cryptographic library. It implements several popular cryptographic algorithms and their tests with some examples.

Most notably, this library has been used in the Nimbus Ethereum client. To see the implementation, check out its Github repository.

The most basic usage

nimble install nimcrypto # installation
# example.nim
import nimcrypto

echo keccak_256.digest("Alice makes a hash") 
# outputs EF0CC652868DF797522FB1D5A39E58E069154D9E47E5D7DB288B7200DB6EDFEE

Documentation

For usage examples of the below algorithm implementations see each module's individual page. In depth documentation also available at Nimbus Libs.

This module provides helper procedures for calculating secure digests supported by nimcrypto library.

This module implements SHA2 (Secure Hash Algorithm 2) set of cryptographic hash functions designed by National Security Agency, version FIPS-180-4. http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf

This module implements RIPEMD set of cryptographic hash functions, designed by Hans Dobbertin, Antoon Bosselaers and Bart Preneel. http://www.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf

This module is Nim adoptation of original C source code by Antoon Bosselaers. https://homes.esat.kuleuven.be/~bosselae/ripemd160/ps/AB-9601/rmd160.c

This module includes support of RIPEMD-128/160/256/320.

This module implements SHA3 (Secure Hash Algorithm 3) set of cryptographic hash functions designed by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.

This module supports SHA3-224/256/384/512 and SHAKE-128/256.

This module implements BLAKE2 set of cryptographic hash functions designed by Jean-Philippe Aumasson, Luca Henzen, Willi Meier, Raphael C.W. Phan.

This module supports BLAKE2s-224/256 and BLAKE2b-384/512.

This module implements HMAC (Keyed-Hashing for Message Authentication) http://www.ietf.org/rfc/rfc2104.txt.

This module implements Rijndael(AES) crypto algorithm by Vincent Rijmen, Antoon Bosselaers and Paulo Barreto.

Code based on version 3.0 (December 2000) of Optimised ANSI C code for the Rijndael cipher http://www.fastcrypto.org/front/misc/rijndael-alg-fst.c.

This module implements Blowfish crypto algorithm by Bruce Schneier

Code based on C implementation of the Blowfish algorithm created by Paul Kocher https://www.schneier.com/code/bfsh-koc.zip.

This module implements Twofish crypto algorithm by Bruce Schneier.

Code based on Optimized C created by Drew Csillag https://www.schneier.com/code/twofish-cpy.zip.

This module implements various Block Cipher Modes.

The five modes currently supported:

  • ECB (Electronic Code Book)
  • CBC (Cipher Block Chaining)
  • CFB (Cipher FeedBack)
  • OFB (Output FeedBack)
  • CTR (Counter)
  • GCM (Galois/Counter Mode)

You can use any of this modes with all the block ciphers of nimcrypto library

GHASH implementation is Nim version of ghash_ctmul64.c which is part of decent BearSSL project https://bearssl.org. Copyright (c) 2016 Thomas Pornin

Utility functions common to all submodules.

This module implements interface to operation system's random number generator.

Windows using BCryptGenRandom (if available), CryptGenRandom(PROV_INTEL_SEC) (if available), RtlGenRandom.

RtlGenRandom (available from Windows XP) BCryptGenRandom (available from Windows Vista SP1) CryptGenRandom(PROV_INTEL_SEC) (only when Intel SandyBridge CPU is available).

Linux using genrandom (if available), /dev/urandom.

OpenBSD using getentropy.

NetBSD, FreeBSD, MacOS, Solaris using /dev/urandom.

nimcrypto's People

Contributors

cheatfate avatar swader avatar zah avatar mratsim avatar stefantalpalaru avatar jangko avatar

Watchers

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