Giter Site home page Giter Site logo

Status of code about hashcash-js HOT 1 OPEN

007 avatar 007 commented on July 17, 2024
Status of code

from hashcash-js.

Comments (1)

007 avatar 007 commented on July 17, 2024

Let me start by saying this is terrible code.

The good news is that it's terrible mostly because it's 8 years old. Fundamentally it's not that bad, it just needs some a lot of love. You'd do better to start with something more recent / complete, but if you want to roll your own here's where to start.

I haven't looked at any of these extensively, so YMMV. The OG hashcash page has a version for WordPress, that's probably a safe bet if that's what you're looking for. TheFox/hashcash looks decent for the PHP side. It requires a DB and doesn't include the JS side since it's aiming for email hashcash compatibility. University of Rhode Island has a full implementation, but I haven't seen the code since it's a zip vs a repo.

The most obvious improvement you've already noted: cleaning it up to not-toy-code state. After that, the things I would look at are:

  • Make it easier to use. Right now you have to manually hook it up everywhere you want to use it, it would be much better to have a single JS include that hooks itself up to all forms on a page, or to all forms with some attribute defined. That's the biggest bang-for-buck improvement.
  • Switch to TOTP for the salt calculation. That still won't require a DB, and makes the code a lot more secure than the arbitrary scheme it uses now.
  • Use a proper hash. Modern browsers are a ton faster and there are good hash implementations all over, that should be swapped out in place of the current "hash" function.
  • Write it in modern PHP and JS. This was before I knew OOP in PHP, and before namespaces existed. It's also before modern JS, and modern JS standards. Yet another reminder that the existing code is REALLY BAD.

If you'd like to poke at this code feel free. I can add a license if you need to use it for business purposes, but I'd recommend against doing so until most / all of the above improvements are done.

from hashcash-js.

Related Issues (1)

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.