Coder Social home page Coder Social logo

coin's Introduction

coin

Token system for PHP.

Introduction

Coin is a simple means of generating tokens that are flexible, secure and can contain an any arbitrary data which is stored within the token itself. A coin is generated using the SHA-1 hashing algorithm and an algorithm that randomly inserts the data within the hash for extraction.

Coin is to be used a means of adding a simple layer of security for applications, it should NOT be used as a method of securing sensitive information and I make no guarantees that this is 100% safe, the data is stored within the string so it is completely viewable by the world and this is not a method of encrypting or hashing!

Now that I've covered those basics here are some examples.

Generating a coin

$coin = new Coin();
$token = $coin->generate('mycoin', 'kB&(T#)G#&(t79 bvrc g0b72uxb479g&T087');

Generates a coin of

bd-36-6-d131b7277331bc917ab780e47cd2a56d3cmycoin6dbf

Take note if you use this example your results will vary as each coin is randomly generated.

Validating a coin

$coin = new Coin();
$validated = $coin->validate($token, 'kB&(T#)G#&(t79 bvrc g0b72uxb479g&T087')

if (!$validated) {
    echo "Invalid coin";
} else {
    echo $validated;
}

// Once validated the coin's value is returned

About the Author

coin is created and maintained by Nickolas Whiting, a developer by day at X Studios, and a engineer by night.

License

coin is released under the Apache 2 license.

coin's People

Contributors

prggmr avatar codezues avatar

Watchers

James Cloos 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.