Giter Club home page Giter Club logo

janet-openssl-hash's Introduction

janet-openssl-hash

This library provides bindings to the EVP_Digest functionality of OpenSSL, which enables cryptographic hash functions to be used in Janet code.

Usage

The package can be installed via the jpm utility, given that OpenSSL 1.1 or higher is installed (including headers, so use the -dev/-devel package if available).

There are three functions:

(openssl-hash/new algorithm-name) Returns a new hasher instance with the given algorithm, or returns an error if the algorithm name is invalid. A list of algorithm names available on your system may be found using the command openssl list -digest-algorithms.

(openssl-hash/feed hasher & data) Hashes data in sequential order. Data may be composed of any object that can be turned into a byte view, including strings and buffers.

(openssl-hash/finalize hasher &opt flag) Returns the hash value of the hasher as a binary string. Once a hasher object has had finalize called on it MUST NOT be used again. Passing the value :hex as the flag argument will cause the result to be converted to hexadecimal ASCII.

Example

(def my-hasher (openssl-hash/new "SHA256"))
(openssl-hash/feed my-hasher "hello world")
(print (openssl-hash/finalize my-hasher :hex))

janet-openssl-hash's People

Contributors

wooosh avatar

Stargazers

Andrew Chou avatar Josef Pospíšil avatar

Watchers

 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.