GithubHelp home page GithubHelp logo

sha256's Introduction

A small SHA-256 implementation for JavaScript

The goals of this project are:

  • small size - the minified version is only 849 bytes
  • readability - the unminified code should be relatively easy to understand/review

Input must be an ASCII string - if character codes outside the range 0-255 are received, undefined is returned.

In the browser

The code (sha256.js or sha256.min.js) defines the sha256(string) function, which returns the hexadecimal-encoded SHA-256 hash of the input string.

AMD is also supported - use index.js instead.

In Node/CommonJS

If you're on Node, you should probably use the version from the built-in crypto module.

However, it is made available as a CommonJS module, including the source code for the minified version:

var sha256 = require('tiny-sha256');

var jsCode = sha256.code + 'alert(sha256("hello!"));';

License

This library is released as "public domain". You can copy, modify, re-release and re-license, or incorporate into any other project without restriction of any kind.

sha256's People

Contributors

geraintluff avatar

Stargazers

 avatar  avatar adamanti avatar  avatar Stefan Huber avatar Brian Norris avatar John avatar Fredrik Ekelund avatar Jonathan Goode avatar Markus Hamburger avatar fayantsev avatar Bertrand Martel avatar Jwala Koundinya avatar Tomáš Konrády avatar  avatar Grandeto avatar AllenK avatar  avatar Justin Yau avatar Kvar Izunia avatar  avatar Richard Yu avatar  B͈̤̖̪̪̱ͅl̯̯̮̼͎̬͚̳̩̖̲u̜̼͉͈̠b͙̬̘̙̱̗̲͙b͍̞̬̬͓̼l̰̪͖̯̼̟̟͈̖͕̜̱̜ͅl̻̗͔̝̭̰͚͇̯̥ avatar  avatar Davehax avatar Hatter Jiang avatar Jesse Clark avatar Azard avatar Aaron Lifton avatar taichi avatar

Watchers

James Cloos avatar  avatar

sha256's Issues

Issue with sha256('abc£123')

The currency pound sign £ is character code 163 (<255), but this library returns the wrong value:

sha256('abc£123');

actual: 25c772bc82b146ed5c1552ec42fc67a1a6140042c3cf1e95721ff0a8b38864f3
expected either:
57c797465642f80fd87c5caa0838c79db1d14b52c6f79819f811aa7550aa4c4d
or
undefined

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.