No description
Find a file
Ievgen Svietikov fcdc448a63 Fixed sha
2018-08-16 17:04:16 +03:00
libsha Fixed sha 2018-08-16 17:04:16 +03:00
tests Fixed sha 2018-08-16 17:04:16 +03:00
.gitignore Improve performance 2018-02-17 03:37:19 +02:00
libsha.nim Improve performance 2018-02-17 03:37:19 +02:00
libsha.nimble Improve performance 2018-02-17 03:37:19 +02:00
LICENSE Initial commit 2018-02-08 14:59:06 +02:00
README.md Improve performance 2018-02-17 03:37:19 +02:00

libsha - SHA1 and SHA2 implementation

Information

  • SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function which takes an input and produces a 160-bit (20-byte) hash value. Wiki
  • SHA-2 (Secure Hash Algorithm 2) is a set of cryptographic hash functions designed by the United States National Security Agency (NSA). Wiki

Installation

Nimble

nimble install https://github.com/forlan-ua/nim-libsha

Repo

git clone https://github.com/forlan-ua/nim-libsha
cd nim-libsh
nimble install

You can use nimble develop instead of nimble install

Tests

Clone the repo then:

nimble install nake
cd tests
nake

Look into nakefile.nim for more tests

Algorithms

  • SHA1: libsha / sha1
  • SHA224: libsha / sha224
  • SHA256: libsha / sha256
  • SHA384: libsha / sha384
  • SHA512: libsha / sha512
  • SHA512/224: libsha / sha512m224
  • SHA512/256: libsha / sha512m256

Usage

import libsha / sha256

let sha = newSha256()
sha.add("The quick brown ")
sha.add("fox jumps over the lazy dog")
echo sha.hexdigest()

or:

import libsha / sha256

echo sha256hexdigest("The quick brown fox jumps over the lazy dog")