All Projects → viniciussanchez → bcrypt

viniciussanchez / bcrypt

Licence: MIT license
BCrypt is a password hashing function

Programming Languages

pascal
1382 projects

Projects that are alternatives of or similar to bcrypt

WebView4Delphi
WebView4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows.
Stars: ✭ 157 (+13.77%)
Mutual labels:  lazarus, freepascal, fpc, embarcadero
BruteForce
A simple brute forcer written in GO for SHA1, SHA256, SHA512, MD5 and bcrypt
Stars: ✭ 49 (-64.49%)
Mutual labels:  password, hash, bcrypt
PospoliteView
Pospolite View aims to be a simple HTML viewer engine fully made in Free Pascal.
Stars: ✭ 29 (-78.99%)
Mutual labels:  lazarus, freepascal, fpc
bookshelf-secure-password
A Bookshelf.js plugin for handling secure passwords
Stars: ✭ 24 (-82.61%)
Mutual labels:  password, hash, bcrypt
crypthash-net
CryptHash.NET is a .NET multi-target library to encrypt/decrypt/hash/encode/decode strings and files, with an optional .NET Core multiplatform console utility.
Stars: ✭ 33 (-76.09%)
Mutual labels:  password, hash, bcrypt
Password4j
Password4j is a user-friendly cryptographic library that supports Argon2, Bcrypt, Scrypt, PBKDF2 and various cryptographic hash functions.
Stars: ✭ 124 (-10.14%)
Mutual labels:  password, hash, bcrypt
TLightFileStream
Implements a lightweight, high-performance, non-allocating advanced-record-based wrapper around the SysUtils file handling routines as an alternative to Classes.TFileStream.
Stars: ✭ 21 (-84.78%)
Mutual labels:  lazarus, freepascal, fpc
lazarus
Notepas sources and other derived lazarus projects using the editor module.
Stars: ✭ 26 (-81.16%)
Mutual labels:  lazarus, freepascal
xavier
Xavier is a small object-oriented XML library for Lazarus and Delphi
Stars: ✭ 38 (-72.46%)
Mutual labels:  lazarus, freepascal
Ascension
A metaheuristic optimization framework
Stars: ✭ 24 (-82.61%)
Mutual labels:  lazarus, freepascal
fp-telegram
Wrapper classes library for telegram bots API (FreePascal)
Stars: ✭ 59 (-57.25%)
Mutual labels:  lazarus, freepascal
sizectrl
TSizeCtrl v8.2
Stars: ✭ 16 (-88.41%)
Mutual labels:  lazarus, freepascal
brookframework
Microframework which helps to develop web Pascal applications.
Stars: ✭ 161 (+16.67%)
Mutual labels:  lazarus, freepascal
DfmExtractor
Small command line utility which allows you to extract DFM, LFM and FRM forms from executable files compiled by Delphi, Lazarus and CodeTyphon.
Stars: ✭ 22 (-84.06%)
Mutual labels:  lazarus, freepascal
csscontrols
Implementation of basic css drawing for pascal (fpc, lazarus, delphi)
Stars: ✭ 26 (-81.16%)
Mutual labels:  lazarus, fpc
troll-hunter
Trollhunter is a single-player roguelike game.
Stars: ✭ 28 (-79.71%)
Mutual labels:  lazarus, fpc
Axes-Armour-Ale
A fantasy, ASCII dungeon crawler for Windows, Linux & OSX
Stars: ✭ 22 (-84.06%)
Mutual labels:  lazarus, freepascal
Fairtris
Clone of the official classic Tetris® game for the NES console, intended for Windows and Linux systems. It implements the original mechanics and includes many regional versions and several RNGs (all in one executable).
Stars: ✭ 30 (-78.26%)
Mutual labels:  lazarus, fpc
torokernel
This repository contains the source code of the unikernel toro
Stars: ✭ 107 (-22.46%)
Mutual labels:  lazarus, freepascal
LazWebsockets
Websocket Server and Client Library written in Lazarus
Stars: ✭ 51 (-63.04%)
Mutual labels:  lazarus, fpc

BCrypt

Platforms

A library to help you hash passwords. You can read about bcrypt in Wikipedia as well as in the following article: How To Safely Store A Password

bcrypt

Installation

Via Boss

For ease I recommend using the Boss (Dependency Manager for Delphi) for installation, simply by running the command below on a terminal (Windows PowerShell for example):

boss install https://github.com/viniciussanchez/bcrypt

Manual

If you choose to install manually, simply add the following folders to your project, in Project > Options > Resource Compiler > Directories and Conditionals > Include file search path

../bcrypt/src

Usage

Generate hash

var
  LHash: string;
begin
  LHash := TBCrypt.GenerateHash(password, cost, type);
end;

Where

  • password is the password to be hashed
  • type is one of THashType.PHP, THashType.BSD, or THashType.Default, THashType.BSD is the default $2a$
  • cost is a number between 10 and 30, default is 10

Compare hash

var
  LVerify : Boolean;
begin
  LVerify := TBCrypt.CompareHash(password, hash);
end;

Where

  • password is the password to be verified
  • hash is a hash generated, similar to $2y$12$GuC.Gk2YDsp8Yvga.IuSNOWM0fxEIsAEaWC1hqEI14Wa.7Ps3iYFq

Get hash info

var
  LHashInfo: THashInfo;
  LSalt, LHash: string;
  LHashType: THashType;
  LCost: Word;
begin
  LHashInfo := TBCrypt.GetHashInfo(hash);
  LCost := LHashInfo.Cost;
  LSalt := LHashInfo.Salt;
  LHash := LHashInfo.Hash;
  LHashType := LHashInfo.&Type;

Where

  • hash is a hash generated

Needs rehash

var
  LNeeds : Boolean;
begin
  LNeeds := TBCrypt.NeedsRehash(hash, cost);
end;

Where

  • hash is a hash, similar to $2y$12$GuC.Gk2YDsp8Yvga.IuSNOWM0fxEIsAEaWC1hqEI14Wa.7Ps3iYFq
  • cost is a number between 10 and 30, default is 10

Hash Info

The characters that comprise the resultant hash are:

./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789

Resultant hashes will be 60 characters long.

bcrypt-calculation-time

Credits

The code for this comes from a few sources:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].