libsha

Sha1 and Sha2 implementations

Pure Nim score 30/100 · tests present · docs generated

Summary

Latest Version Unknown
License MIT
CI Status Passing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

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

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
libsha - - - - - - -

Source

Repository https://github.com/forlan-ua/nim-libsha
Homepage https://github.com/forlan-ua/nim-libsha
Documentation View Documentation
Registry Source nimble_official

README

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")