Giter VIP home page Giter VIP logo

apex-bcrypt's Introduction

apex-bcrypt

Bcrypt implementation in the Salesforce Apex language, based on the JavaScript library bcrypt.js

Security considerations

Besides incorporating a salt to protect against rainbow table attacks, bcrypt is an adaptive function: over time, the iteration count can be increased to make it slower, so it remains resistant to brute-force search attacks even with increasing computation power. (see)

The maximum input length is 72 bytes (note that UTF8 encoded characters use up to 4 bytes) and the length of generated hashes is 60 characters.

Deploy to Salesforce

Deploy to Salesforce

Usage

To hash a password:

String salt = Bcrypt.genSalt(10);
String hash = Bcrypt.hash('mypassword', salt);
// Store hash in Salesforce.

To check a password:

// Load hash from Salesforce.
Bcrypt.compare('mypassword', hash); // true
Bcrypt.compare('not_mypassword', hash); // false

Auto-gen a salt and hash:

String hash = Bcrypt.hash('mypassword');
// OR to specify the number of rounds
String hash = Bcrypt.hash('mypassword', 8);

apex-bcrypt's People

Contributors

charleseasyvest avatar pierrevanobbergen avatar

Stargazers

 avatar  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.