Giter Site home page Giter Site logo

sha256's Introduction

A tiny SHA256 implementation

Written in one rage burst after finding that browsers only provide promises (the most absurd interface I could think of for such a job, only a committee or someone insanely obsessed with promises would be able to come up with that).

Written by reading specs, tested a bit but not much... YMMV.

Speed is decent for my use.

Interface

 sha256(data) → digest

 let s = sha256();
 s.add(data);
 s.digest() → digest

The returned digest is an Uint8Array instance of 32 bytes with a stapled on addition of a .hex() method returning a string.

Input is expected to be a string (converted to utf-8 for hashing) or an Uint8Array object (or anything for which .forEach behaves in a similar way).

As a convenience HMAC-SHA256 is also implemented

sha256's People

Contributors

6502 avatar

Stargazers

Ethan Reesor avatar Tobias avatar Jonathan Gros-Dubois avatar Finn Bear avatar  avatar Tiberiu Ichim avatar Raine Revere avatar Aaron avatar Sven Neumann avatar John B avatar __ avatar  avatar Ian Mathews avatar  avatar Tomasz Lenarcik avatar cmd avatar Sam Claus avatar Georges Gabereau avatar  avatar

Watchers

 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.